Moved all update() and toEntity action model functions to async
ref #76
This commit is contained in:
parent
3f7b0f6563
commit
3deae2bfeb
|
@ -54,7 +54,7 @@ export class RunnerTeamController {
|
|||
async post(@Body({ validate: true }) createRunnerTeam: CreateRunnerTeam) {
|
||||
let runnerTeam;
|
||||
try {
|
||||
runnerTeam = await createRunnerTeam.toRunnerTeam();
|
||||
runnerTeam = await createRunnerTeam.toEntity();
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ export class TrackController {
|
|||
@Body({ validate: true })
|
||||
track: CreateTrack
|
||||
) {
|
||||
return new ResponseTrack(await this.trackRepository.save(track.toEntity()));
|
||||
return new ResponseTrack(await this.trackRepository.save(await track.toEntity()));
|
||||
}
|
||||
|
||||
@Put('/:id')
|
||||
|
|
|
@ -56,7 +56,7 @@ export class CreateAddress {
|
|||
/**
|
||||
* Creates a new Address entity from this.
|
||||
*/
|
||||
public toEntity(): Address {
|
||||
public async toEntity(): Promise<Address> {
|
||||
let newAddress: Address = new Address();
|
||||
|
||||
newAddress.address1 = this.address1;
|
||||
|
|
|
@ -37,7 +37,7 @@ export class CreateRunnerTeam extends CreateRunnerGroup {
|
|||
/**
|
||||
* Creates a new RunnerTeam entity from this.
|
||||
*/
|
||||
public async toRunnerTeam(): Promise<RunnerTeam> {
|
||||
public async toEntity(): Promise<RunnerTeam> {
|
||||
let newRunnerTeam: RunnerTeam = new RunnerTeam();
|
||||
|
||||
newRunnerTeam.name = this.name;
|
||||
|
|
|
@ -37,7 +37,7 @@ export class UpdateTrack {
|
|||
* Update a Track entity based on this.
|
||||
* @param track The track that shall be updated.
|
||||
*/
|
||||
public update(track: Track): Track {
|
||||
public async update(track: Track): Promise<Track> {
|
||||
track.name = this.name;
|
||||
track.distance = this.distance;
|
||||
track.minimumLapTime = this.minimumLapTime;
|
||||
|
|
Loading…
Reference in New Issue