Switched to declaring the track route for the whole controller

ref #4
This commit is contained in:
Nicolai Ort 2020-11-26 13:41:23 +01:00
parent 2c29fe29e8
commit c85fddaa8e

View File

@ -22,27 +22,27 @@ export class TrackController {
this.trackRepository = getConnectionManager().get().getRepository(Track); this.trackRepository = getConnectionManager().get().getRepository(Track);
} }
@Get("/track") @Get()
async getAll() { async getAll() {
return await this.trackRepository.find(); return await this.trackRepository.find();
} }
@Get("/track/:id") @Get(":id")
async getOne(@EntityFromParam("id") track: Track) { async getOne(@EntityFromParam("id") track: Track) {
return track; return track;
} }
@Post("/track") @Post()
post(@EntityFromBody() track: Track) { post(@EntityFromBody() track: Track) {
return this.trackRepository.save(track); return this.trackRepository.save(track);
} }
@Put("/track/:id") @Put(":id")
put(@Param("id") id: number, @Body() user: any) { put(@Param("id") id: number, @Body() user: any) {
return "Updating a user..."; return "Updating a user...";
} }
@Delete("/track/:id") @Delete(":id")
remove(@EntityFromParam("id") track: Track) { remove(@EntityFromParam("id") track: Track) {
return this.trackRepository.delete(track); return this.trackRepository.delete(track);
} }