Updated comments
continuous-integration/drone/pr Build is failing Details

ref #67
This commit is contained in:
Nicolai Ort 2021-01-08 18:37:33 +01:00
parent 9cc50078d1
commit c591c182b3
4 changed files with 18 additions and 9 deletions

View File

@ -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<Runner> {
const runner = await getConnection().getRepository(Runner).findOne({ id: this.runner });
if (!runner) {

View File

@ -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<Track> {
const track = await getConnection().getRepository(Track).findOne({ id: this.track });
if (!track) {

View File

@ -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<Runner> {
const runner = await getConnection().getRepository(Runner).findOne({ id: this.runner });
if (!runner) {

View File

@ -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<ScanStation> {
station.description = this.description;