feat(users): add API documentation properties to CreateUserDto using Swagger decorators
This commit is contained in:
parent
b61f297497
commit
ba8d78442c
@ -1,21 +1,40 @@
|
|||||||
import { IsString, IsNotEmpty, IsOptional, IsObject } from 'class-validator';
|
import { IsString, IsNotEmpty, IsOptional, IsObject } from 'class-validator';
|
||||||
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DTO for creating a new user
|
* DTO for creating a new user
|
||||||
*/
|
*/
|
||||||
export class CreateUserDto {
|
export class CreateUserDto {
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'The name of the user',
|
||||||
|
example: 'John Doe'
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'The avatar URL of the user',
|
||||||
|
example: 'https://example.com/avatar.png',
|
||||||
|
required: false
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'The GitHub ID of the user',
|
||||||
|
example: 'github123456'
|
||||||
|
})
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
githubId: string;
|
githubId: string;
|
||||||
|
|
||||||
|
@ApiProperty({
|
||||||
|
description: 'Additional metadata for the user',
|
||||||
|
example: { email: 'john.doe@example.com' },
|
||||||
|
required: false
|
||||||
|
})
|
||||||
@IsObject()
|
@IsObject()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
metadata?: Record<string, any>;
|
metadata?: Record<string, any>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user