Abstracted a little bit more for potential company runner import

This commit is contained in:
2020-12-17 16:32:29 +01:00
parent cad30c7f63
commit 1b59d58c60
3 changed files with 7 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
export class ImportRunner {
export abstract class ImportRunner {
/**
* The new runner's first name.
@@ -23,4 +23,6 @@ export class ImportRunner {
@IsString()
@IsNotEmpty()
lastname: string;
public abstract toCreateRunner(groupID?: number);
}

View File

@@ -18,13 +18,13 @@ export class ImportSchoolRunner extends ImportRunner {
@IsNotEmpty()
class: string;
public async toCreateRunner(orgID: number): Promise<CreateRunner> {
public async toCreateRunner(groupID: number): Promise<CreateRunner> {
let newRunner: CreateRunner = new CreateRunner();
newRunner.firstname = this.firstname;
newRunner.middlename = this.middlename;
newRunner.lastname = this.lastname;
newRunner.group = (await this.getGroup(orgID)).id;
newRunner.group = (await this.getGroup(groupID)).id;
console.log(newRunner.group)
return newRunner;