@@ -8,14 +8,52 @@ import {statusMessage} from '../constant/statusMessage'
88import { HttpExceptionFilter } from '../utils/http-exception.filter' ;
99import { responseData , userData } from '../interface/common' ;
1010import { AuthGuard } from '../common/guards/at.guard' ;
11- import { ApiResponse } from '@nestjs/swagger' ;
12-
11+ import { ApiOperation , ApiResponse , ApiTags } from '@nestjs/swagger' ;
1312
1413
14+ @ApiTags ( 'users' )
1515@Controller ( "v1/users" )
1616export class UserController {
1717 constructor ( private readonly userService : UserService ) { }
18-
18+
19+ @ApiOperation ( {
20+ summary : 'Create user' ,
21+ description : 'User signup app' ,
22+ } )
23+ @ApiResponse ( {
24+ status : 200 ,
25+ description : 'Success! Returns the data.' ,
26+ content : {
27+ 'application/json' : {
28+ schema : {
29+ type : 'object' ,
30+ properties : {
31+ statusCode : { type : 'number' , example : 201 } ,
32+ isSuccess : { type : 'boolean' , example : true } ,
33+ message : { type : 'string' , example : 'Record Created' } ,
34+ data : { type : 'object' , example : 'Record Created' }
35+ } ,
36+ } ,
37+ example : {
38+ "statusCode" : 201 ,
39+ "isSuccess" : true ,
40+ "message" : "Record Created" ,
41+ "data" : {
42+ "username" : "test username" ,
43+ "first_name" : "pradip" ,
44+ "last_name" : "patil" ,
45+ "email" : "pradip@test.com" ,
46+ "email_code" : "DAQJ1" ,
47+ "password" : "4xeuIuIK3XGXHX3xtMBAM4uYeWlWsOg8RC" ,
48+ "password_reset_code" : "122222" ,
49+ "createdAt" : "2023-12-22T04:45:45.710Z" ,
50+ "updatedAt" : "2023-12-22T04:45:45.710Z" ,
51+ "_id" : "6585147f97b06"
52+ }
53+ } ,
54+ } ,
55+ } ,
56+ } )
1957 @Public ( )
2058 @Post ( )
2159 @UseFilters ( new HttpExceptionFilter ( ) )
@@ -27,13 +65,12 @@ export class UserController {
2765
2866// get user
2967@ApiResponse ( { status : 200 , description : 'The record has been successfully fetch.' } )
30- @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
68+ @ApiResponse ( { status : 403 , description : 'Forbidden.' } )
3169 @UseGuards ( AuthGuard )
3270 @Get ( )
3371 @UseFilters ( new HttpExceptionFilter ( ) )
3472 async findAll ( ) : Promise < userData [ ] > {
3573 return this . userService . findAll ( ) ;
3674 }
37-
3875}
3976
0 commit comments