diff --git a/src/models/actions/create/CreateRunnerGroup.ts b/src/models/actions/create/CreateRunnerGroup.ts index 0b62024..aadea29 100644 --- a/src/models/actions/create/CreateRunnerGroup.ts +++ b/src/models/actions/create/CreateRunnerGroup.ts @@ -1,6 +1,6 @@ import { IsInt, IsNotEmpty, IsOptional, IsString } from 'class-validator'; import { getConnectionManager } from 'typeorm'; -import { GroupContactNotFoundError, GroupContactWrongTypeError } from '../../../errors/GroupContactErrors'; +import { GroupContactNotFoundError } from '../../../errors/GroupContactErrors'; import { GroupContact } from '../../entities/GroupContact'; /** @@ -15,7 +15,7 @@ export abstract class CreateRunnerGroup { name: string; /** - * The new group's contact. + * The new group's contact's id. * Optional */ @IsInt() @@ -26,15 +26,10 @@ export abstract class CreateRunnerGroup { * Gets the new group's contact by it's id. */ public async getContact(): Promise { - if (this.contact === undefined || this.contact === null) { - return null; - } - if (!isNaN(this.contact)) { - let contact = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact }); - if (!contact) { throw new GroupContactNotFoundError; } - return contact; - } + if (!this.contact) { return null; } + let contact = await getConnectionManager().get().getRepository(GroupContact).findOne({ id: this.contact }); + if (!contact) { throw new GroupContactNotFoundError; } + return contact; - throw new GroupContactWrongTypeError; } } \ No newline at end of file