From 8a663c7bad0906b9eb84253bb4d2dcfd6b70d04b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Mon, 12 Sep 2022 12:41:20 +0900 Subject: [PATCH] nestjs_auth init.. --- src/todo/todo.controller.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/todo/todo.controller.ts b/src/todo/todo.controller.ts index 939f041..70ed45a 100644 --- a/src/todo/todo.controller.ts +++ b/src/todo/todo.controller.ts @@ -106,8 +106,8 @@ export class TodoController { console.log(fetchSQL) //전체 갯수 및 fetched Data - const total = this.todoService.count(fetchSQL) - const rows = this.todoService.fetchAll(fetchSQL) + const total = await this.todoService.count(fetchSQL) + const rows = await this.todoService.fetchAll(fetchSQL) const result = { total: total, perPage: perPage, @@ -122,26 +122,26 @@ export class TodoController { } @Get(':id') - async fetchOne(@Param('id') id: string): Promise { - return this.todoService.fetchOne({ id: Number(id) }) + async fetchOne(@Param('id') id: string) { + return await this.todoService.fetchOne({ id: Number(id) }) } @Post() - async add(@Body() data: TodoDTO): Promise { - return this.todoService.add(data) + async add(@Body() data: TodoDTO) { + return await this.todoService.add(data) } @Put(':id') - async update(@Param('id') id: string, @Body() data: TodoDTO): Promise { + async update(@Param('id') id: string, @Body() data: TodoDTO) { data.updatedAt = new Date() - return this.todoService.update({ + return await this.todoService.update({ where: { id: Number(id) }, data: data }) } @Delete(':id') - async delete(@Param('id') id: string): Promise { - return this.todoService.remove({ id: Number(id) }) + async delete(@Param('id') id: string) { + return await this.todoService.remove({ id: Number(id) }) } }