-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Get exchange rates * name fix * typo * enable disabled cronjob * Update services/121-service/src/exchange-rates/exchange-rates.controller.ts Co-authored-by: Peter Smallenbroek <[email protected]> --------- Co-authored-by: Ruben <[email protected]> Co-authored-by: Peter Smallenbroek <[email protected]>
- Loading branch information
1 parent
b336a14
commit 22f8b7b
Showing
11 changed files
with
92 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
services/121-service/src/exchange-rates/dtos/get-exchange-rate.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
|
||
export class GetExchangeRateDto { | ||
@ApiProperty({ example: 'KES', type: 'string' }) | ||
public currency: string; | ||
|
||
@ApiProperty({ example: '0.00744368', type: 'number' }) | ||
public euroExchangeRate: number; | ||
|
||
@ApiProperty({ | ||
example: '2025-01-15T23:59:59Z', | ||
type: 'string', | ||
nullable: true, | ||
}) | ||
public closeTime: string | null; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
services/121-service/src/exchange-rates/exchange-rates.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Controller, UseGuards } from '@nestjs/common'; | ||
import { Get, HttpStatus } from '@nestjs/common'; | ||
import { ApiTags } from '@nestjs/swagger'; | ||
import { ApiOperation, ApiResponse } from '@nestjs/swagger'; | ||
|
||
import { GetExchangeRateDto } from '@121-service/src/exchange-rates/dtos/get-exchange-rate.dto'; | ||
import { ExchangeRatesService } from '@121-service/src/exchange-rates/exchange-rates.service'; | ||
import { AuthenticatedUser } from '@121-service/src/guards/authenticated-user.decorator'; | ||
import { AuthenticatedUserGuard } from '@121-service/src/guards/authenticated-user.guard'; | ||
|
||
@UseGuards(AuthenticatedUserGuard) | ||
@ApiTags('exchange-rates') | ||
@Controller('exchange-rates') | ||
export class ExchangeRatesController { | ||
public constructor( | ||
private readonly exchangeRateService: ExchangeRatesService, | ||
) {} | ||
|
||
@AuthenticatedUser({ isAdmin: true }) | ||
@ApiOperation({ | ||
summary: 'Get all exchange rates', | ||
}) | ||
@ApiResponse({ | ||
status: HttpStatus.OK, | ||
description: 'Gets all exchange rates for a program', | ||
type: [GetExchangeRateDto], | ||
}) | ||
@Get() | ||
public async getAll(): Promise<GetExchangeRateDto[]> { | ||
return this.exchangeRateService.getAll(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters