diff --git a/src/models/actions/CreateScan.ts b/src/models/actions/CreateScan.ts index ef6d0e4..e0d0efc 100644 --- a/src/models/actions/CreateScan.ts +++ b/src/models/actions/CreateScan.ts @@ -5,7 +5,7 @@ import { Runner } from '../entities/Runner'; import { Scan } from '../entities/Scan'; /** - * This classed is used to create a new Scan entity from a json body (post request). + * This class is used to create a new Scan entity from a json body (post request). */ export abstract class CreateScan { /** @@ -46,6 +46,9 @@ export abstract class CreateScan { return newScan; } + /** + * Gets a runner based on the runner id provided via this.runner. + */ public async getRunner(): Promise { const runner = await getConnection().getRepository(Runner).findOne({ id: this.runner }); if (!runner) { diff --git a/src/models/actions/CreateScanStation.ts b/src/models/actions/CreateScanStation.ts index 76d414a..5d93b7c 100644 --- a/src/models/actions/CreateScanStation.ts +++ b/src/models/actions/CreateScanStation.ts @@ -8,19 +8,18 @@ import { ScanStation } from '../entities/ScanStation'; import { Track } from '../entities/Track'; /** - * This classed is used to create a new StatsClient entity from a json body (post request). + * This class is used to create a new StatsClient entity from a json body (post request). */ export class CreateScanStation { /** - * The new client's description. + * The new station's description. */ @IsString() @IsOptional() description?: string; /** - * The scan's associated track. - * This is used to determine the scan's distance. + * The station's associated track. */ @IsInt() @IsPositive() @@ -51,6 +50,10 @@ export class CreateScanStation { return newStation; } + /** + * Get's a track by it's id provided via this.track. + * Used to link the new station to a track. + */ public async getTrack(): Promise { const track = await getConnection().getRepository(Track).findOne({ id: this.track }); if (!track) { diff --git a/src/models/actions/UpdateScan.ts b/src/models/actions/UpdateScan.ts index a51ccea..00b375e 100644 --- a/src/models/actions/UpdateScan.ts +++ b/src/models/actions/UpdateScan.ts @@ -5,7 +5,7 @@ import { Runner } from '../entities/Runner'; import { Scan } from '../entities/Scan'; /** - * This classed is used to create a new Scan entity from a json body (post request). + * This class is used to update a Scan entity (via put request) */ export abstract class UpdateScan { /** @@ -49,6 +49,9 @@ export abstract class UpdateScan { return scan; } + /** + * Gets a runner based on the runner id provided via this.runner. + */ public async getRunner(): Promise { const runner = await getConnection().getRepository(Runner).findOne({ id: this.runner }); if (!runner) { diff --git a/src/models/actions/UpdateScanStation.ts b/src/models/actions/UpdateScanStation.ts index 24039a0..a8ebc6a 100644 --- a/src/models/actions/UpdateScanStation.ts +++ b/src/models/actions/UpdateScanStation.ts @@ -2,7 +2,7 @@ import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator'; import { ScanStation } from '../entities/ScanStation'; /** - * This classed is used to create a new StatsClient entity from a json body (post request). + * This class is used to update a ScanStation entity (via put request) */ export class UpdateScanStation { /** @@ -27,8 +27,8 @@ export class UpdateScanStation { enabled?: boolean = true; /** - * Converts this to a ScanStation entity. - * TODO: + * Update a ScanStation entity based on this. + * @param station The station that shall be updated. */ public async updateStation(station: ScanStation): Promise { station.description = this.description;