Last active
October 13, 2021 15:38
-
-
Save rskhan167/475888e3f060d053cca512d28771d8bf to your computer and use it in GitHub Desktop.
Revisions
-
rskhan167 revised this gist
Oct 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ export class UserController { } @Post() @ApiOkResponse({ status: 201, type: User }) async create(@Body() createUserDto: CreateUserDto): Promise<User> { return await this.userService.create(createUserDto); } -
rskhan167 revised this gist
Oct 13, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ export class UserController { constructor(private readonly userService: UserService) {} @Get('all') @ApiOkResponse({ status: 200, type: User, isArray: true }) async getAll(): Promise<User[]> { return this.userService.getAll(); } -
rskhan167 created this gist
Oct 13, 2021 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ import { Controller, Post, Body, Get, Param } from '@nestjs/common'; import { ApiOkResponse } from '@nestjs/swagger'; import { CreateUserDto } from './dtos/create-user.dto'; import { UserService } from './user.service'; import { User } from './entities/user.entity'; @Controller('user') export class UserController { constructor(private readonly userService: UserService) {} @Get('all') @ApiOkResponse({ status: 200, type: [User] }) async getAll(): Promise<User[]> { return this.userService.getAll(); } @Get(':userId') @ApiOkResponse({ status: 200, type: User }) async getUser(@Param('userId') userId: number): Promise<User> { return await this.userService.getUser(userId); } @Post() @ApiOkResponse({ status: 200, type: User }) async create(@Body() createUserDto: CreateUserDto): Promise<User> { return await this.userService.create(createUserDto); } }