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
1 changed files with 5 additions and 5 deletions

View File

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