From 918b15c3153454623e43ae3900c4e8ec60c67cc4 Mon Sep 17 00:00:00 2001 From: Abdalhameed Ahmad Date: Tue, 23 Sep 2025 09:00:41 +0300 Subject: [PATCH] fix: add swagger --- src/junior/controllers/junior.controller.ts | 3 ++- src/junior/dtos/response/weekly-summary.response.dto.ts | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/junior/controllers/junior.controller.ts b/src/junior/controllers/junior.controller.ts index b54d397..d3a472a 100644 --- a/src/junior/controllers/junior.controller.ts +++ b/src/junior/controllers/junior.controller.ts @@ -32,6 +32,7 @@ import { ThemeResponseDto, TransferToJuniorResponseDto, } from '../dtos/response'; +import { WeeklySummaryResponseDto } from '../dtos/response/weekly-summary.response.dto'; import { JuniorService } from '../services'; @Controller('juniors') @@ -148,7 +149,7 @@ export class JuniorController { @Get(':juniorId/weekly-summary') @UseGuards(RolesGuard) @AllowedRoles(Roles.GUARDIAN) - @ApiDataResponse('string') + @ApiDataResponse(WeeklySummaryResponseDto) async getWeeklySummary( @Param('juniorId', CustomParseUUIDPipe) juniorId: string, @AuthenticatedUser() user: IJwtPayload, diff --git a/src/junior/dtos/response/weekly-summary.response.dto.ts b/src/junior/dtos/response/weekly-summary.response.dto.ts index 310e0f6..5c1e7e5 100644 --- a/src/junior/dtos/response/weekly-summary.response.dto.ts +++ b/src/junior/dtos/response/weekly-summary.response.dto.ts @@ -1,12 +1,13 @@ import { ApiProperty } from '@nestjs/swagger'; export class WeeklySummaryResponseDto { + @ApiProperty({ description: 'Start date of the week', example: '2023-10-01' }) + startOfWeek!: Date; + @ApiProperty({ description: 'End date of the week', example: '2023-10-07' }) + endOfWeek!: Date; @ApiProperty({ description: 'Total amount spent in the week', example: 350 }) total!: number; - @ApiProperty({ description: 'range', example: '2023-10-01 - 2023-10-07' }) - range!: string; - @ApiProperty({ description: 'Amount spent on Sunday', example: 50 }) sunday!: number;