nestjs_auth init..
This commit is contained in:
parent
48a6e1d13d
commit
8a663c7bad
@ -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<Todo | undefined> {
|
||||
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<Todo> {
|
||||
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<Todo> {
|
||||
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<Todo | undefined> {
|
||||
return this.todoService.remove({ id: Number(id) })
|
||||
async delete(@Param('id') id: string) {
|
||||
return await this.todoService.remove({ id: Number(id) })
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user