Put now isn't allowed to change ids

ref #4
This commit is contained in:
Nicolai Ort 2020-11-27 19:59:07 +01:00
parent b267d87ba6
commit aef2f9562a
1 changed files with 5 additions and 1 deletions

View File

@ -64,7 +64,11 @@ export class TrackController {
let oldTrack = await this.trackRepository.findOne({ id: id });
if (!oldTrack) {
throw new TrackNotFoundError();
throw new TrackNotFoundError();
}
if(oldTrack.id != track.id){
throw new NotAcceptableError("The id's don't match!");
}
await this.trackRepository.update(oldTrack, track);