Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return this.listService.findAll();
}
@httpPost('/')
public async create( @response() res: Response, @requestBody() body: any): Promise {
await this.listService.create(body);
return {};
}
@httpDelete('/:id')
public async destroy( @response() res: Response, @requestParam('id') id: string): Promise {
await this.listService.delete(id);
return {};
}
@httpPut('/:id')
public async update( @response() res: Response, @requestParam('id') id: string, @requestBody() body: any): Promise {
await this.listService.update(id, body);
return {};
}
}
}
@httpPost('/')
public async create( @response() res: Response, @requestBody() body: any): Promise {
await this.settingsService.create(body);
this.syncRunnerService.setupSyncList();
return {};
}
@httpDelete('/:id')
public async destroy( @response() res: Response, @requestParam('id') id: string): Promise {
await this.settingsService.delete(id);
return {};
}
@httpPut('/:id')
public async update( @response() res: Response, @requestParam('id') id: string, @requestBody() body: any): Promise {
await this.settingsService.update(id, body);
this.syncRunnerService.setupSyncList();
return {};
}
}
return res.json({ todo });
})
.catch(next);
}
@httpDelete('/:id', authMiddlware.bearerStrategy)
public removeTodo(req: IRequest, res: Response, next: NextFunction) {
const id = req.params.id;
return this._todoService.removeTodo(id, req.user.id)
.then((todo) => {
return res.json({ todo });
})
.catch(next);
}
@httpPut('/:id', authMiddlware.bearerStrategy)
public changeComplete(req: IRequest, res: Response, next: NextFunction) {
const id = req.params.id;
return this._todoService.changeComplete(id, req.user.id, req.body.completed)
.then((todo) => {
return res.json({ todo });
})
.catch(next);
}
}