nestjs_auth init..

This commit is contained in:
최준흠 2022-09-12 12:41:20 +09:00
parent 48a6e1d13d
commit 8a663c7bad

View File

@ -106,8 +106,8 @@ export class TodoController {
console.log(fetchSQL) console.log(fetchSQL)
//전체 갯수 및 fetched Data //전체 갯수 및 fetched Data
const total = this.todoService.count(fetchSQL) const total = await this.todoService.count(fetchSQL)
const rows = this.todoService.fetchAll(fetchSQL) const rows = await this.todoService.fetchAll(fetchSQL)
const result = { const result = {
total: total, total: total,
perPage: perPage, perPage: perPage,
@ -122,26 +122,26 @@ export class TodoController {
} }
@Get(':id') @Get(':id')
async fetchOne(@Param('id') id: string): Promise<Todo | undefined> { async fetchOne(@Param('id') id: string) {
return this.todoService.fetchOne({ id: Number(id) }) return await this.todoService.fetchOne({ id: Number(id) })
} }
@Post() @Post()
async add(@Body() data: TodoDTO): Promise<Todo> { async add(@Body() data: TodoDTO) {
return this.todoService.add(data) return await this.todoService.add(data)
} }
@Put(':id') @Put(':id')
async update(@Param('id') id: string, @Body() data: TodoDTO): Promise<Todo> { async update(@Param('id') id: string, @Body() data: TodoDTO) {
data.updatedAt = new Date() data.updatedAt = new Date()
return this.todoService.update({ return await this.todoService.update({
where: { id: Number(id) }, where: { id: Number(id) },
data: data data: data
}) })
} }
@Delete(':id') @Delete(':id')
async delete(@Param('id') id: string): Promise<Todo | undefined> { async delete(@Param('id') id: string) {
return this.todoService.remove({ id: Number(id) }) return await this.todoService.remove({ id: Number(id) })
} }
} }