From ba8d78442c5184ceb4fd64bd30e42a78ae091b98 Mon Sep 17 00:00:00 2001 From: Mathis HERRIOT <197931332+0x485254@users.noreply.github.com> Date: Fri, 16 May 2025 19:10:20 +0200 Subject: [PATCH] feat(users): add API documentation properties to CreateUserDto using Swagger decorators --- .../src/modules/users/dto/create-user.dto.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/backend/src/modules/users/dto/create-user.dto.ts b/backend/src/modules/users/dto/create-user.dto.ts index 4fae9e5..cf76d3d 100644 --- a/backend/src/modules/users/dto/create-user.dto.ts +++ b/backend/src/modules/users/dto/create-user.dto.ts @@ -1,22 +1,41 @@ import { IsString, IsNotEmpty, IsOptional, IsObject } from 'class-validator'; +import { ApiProperty } from '@nestjs/swagger'; /** * DTO for creating a new user */ export class CreateUserDto { + @ApiProperty({ + description: 'The name of the user', + example: 'John Doe' + }) @IsString() @IsNotEmpty() name: string; + @ApiProperty({ + description: 'The avatar URL of the user', + example: 'https://example.com/avatar.png', + required: false + }) @IsString() @IsOptional() avatar?: string; + @ApiProperty({ + description: 'The GitHub ID of the user', + example: 'github123456' + }) @IsString() @IsNotEmpty() githubId: string; + @ApiProperty({ + description: 'Additional metadata for the user', + example: { email: 'john.doe@example.com' }, + required: false + }) @IsObject() @IsOptional() metadata?: Record; -} \ No newline at end of file +}