Adjusted the comments for tsdoc

ref #8 #3
This commit is contained in:
2020-11-27 22:19:07 +01:00
parent 15552eff54
commit f0a7cbbcae
3 changed files with 24 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ import { EntityFromBody } from 'typeorm-routing-controllers-extensions';
import { OpenAPI, ResponseSchema } from 'routing-controllers-openapi';
import { Track } from '../models/Track';
import { IsInt, IsNotEmpty, IsPositive, IsString } from 'class-validator';
import {TrackIdChangeNotAllowedError, TrackNotFoundError} from "../errors/TrackErrors";
import {TrackIdsNotMatchingError, TrackNotFoundError} from "../errors/TrackErrors";
class CreateTrack {
@IsString()
@@ -57,7 +57,7 @@ export class TrackController {
@Put('/:id')
@ResponseSchema(Track)
@ResponseSchema(TrackNotFoundError, {statusCode: 404})
@ResponseSchema(TrackIdChangeNotAllowedError, {statusCode: 406})
@ResponseSchema(TrackIdsNotMatchingError, {statusCode: 406})
@OpenAPI({description: "Update a track object (id can't be changed)."})
async put(@Param('id') id: number, @EntityFromBody() track: Track) {
let oldTrack = await this.trackRepository.findOne({ id: id });
@@ -67,7 +67,7 @@ export class TrackController {
}
if(oldTrack.id != track.id){
throw new TrackIdChangeNotAllowedError();
throw new TrackIdsNotMatchingError();
}
await this.trackRepository.update(oldTrack, track);