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) }) } }