diff --git a/src/user/user.controller.ts b/src/user/user.controller.ts index 5450f09..a9dccaf 100644 --- a/src/user/user.controller.ts +++ b/src/user/user.controller.ts @@ -25,7 +25,7 @@ export class UserController { @Roles(ROLE.ADMIN) @UseGuards(JwtAuthGuard, RolesGuard) @Get() - fetchAll(@Query() query) { + async fetchAll(@Query() query) { console.log(query) //Field별 filter AND Sql용 @@ -114,8 +114,8 @@ export class UserController { console.log(fetchSQL) //전체 갯수 및 fetched Data - const total = this.userService.count(fetchSQL) - const rows = this.userService.fetchAll(fetchSQL) + const total = await this.userService.count(fetchSQL) + const rows = await this.userService.fetchAll(fetchSQL) const result = { total: total, perPage: perPage, @@ -132,23 +132,23 @@ export class UserController { @Roles(ROLE.ADMIN) @UseGuards(JwtAuthGuard, RolesGuard) @Get(':id') - fetchOne(@Param('id') id: string): Promise { - return this.userService.fetchOne({ id: Number(id) }) + async fetchOne(@Param('id') id: string) { + return await this.userService.fetchOne({ id: Number(id) }) } @Roles(ROLE.ADMIN) @UseGuards(JwtAuthGuard, RolesGuard) @Post('add') - add(@Body() data: UserDTO): Promise { - return this.userService.add(data) + async add(@Body() data: UserDTO) { + return await this.userService.add(data) } @Roles(ROLE.ADMIN) @UseGuards(JwtAuthGuard, RolesGuard) @Put(':id') - update(@Param('id') id: string, @Body() data: UserDTO): Promise { + async update(@Param('id') id: string, @Body() data: UserDTO) { data.updatedAt = new Date() - return this.userService.update({ + return await this.userService.update({ where: { id: Number(id) }, data: data }) @@ -157,7 +157,7 @@ export class UserController { @Roles(ROLE.ADMIN) @UseGuards(JwtAuthGuard, RolesGuard) @Delete(':id') - delete(@Param('id') id: string): Promise { - return this.userService.remove({ id: Number(id) }) + async delete(@Param('id') id: string): Promise { + return await this.userService.remove({ id: Number(id) }) } }