More dynamic creation of objects

ref #13
This commit is contained in:
2020-12-05 15:50:28 +01:00
parent 975d30e411
commit 4352910d54
10 changed files with 212 additions and 67 deletions

View File

@@ -0,0 +1,18 @@
import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
export class AddressWrongTypeError extends NotAcceptableError {
@IsString()
name = "AddressWrongTypeError"
@IsString()
message = "The address must be either a existing address, new address or a existing adress's id. \n You provided a object of another type."
}
export class AddressNotFoundError extends NotFoundError {
@IsString()
name = "AddressNotFoundError"
@IsString()
message = "The address you provided couldn't be located in the system. \n Please check your request."
}

View File

@@ -0,0 +1,18 @@
import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
export class GroupContactWrongTypeError extends NotAcceptableError {
@IsString()
name = "GroupContactWrongTypeError"
@IsString()
message = "The groupContact must be either a existing groupContact, new groupContact or a existing adress's id. \n You provided a object of another type."
}
export class GroupContactNotFoundError extends NotFoundError {
@IsString()
name = "GroupContactNotFoundError"
@IsString()
message = "The groupContact you provided couldn't be located in the system. \n Please check your request."
}

View File

@@ -1,18 +0,0 @@
import { IsString } from 'class-validator';
import { NotAcceptableError, NotFoundError } from 'routing-controllers';
export class ParticipantAddressWrongTypeError extends NotAcceptableError {
@IsString()
name = "ParticipantAddressWrongTypeError"
@IsString()
message = "The participant's address must be either a existing address, new address or a existing adress's id. \n You provided a object of another type."
}
export class ParticipantAddressNotFoundError extends NotFoundError {
@IsString()
name = "ParticipantAddressNotFoundError"
@IsString()
message = "The address you provided couldn't be located in the system. \n Please check your request."
}

View File

@@ -48,4 +48,12 @@ export class RunnerOrganisationHasTeamsError extends NotAcceptableError {
@IsString()
message = "This organisation still has teams associated with it. \n If you want to delete this organisation with all it's runners and teams ass `?force` to your query."
}
}
export class RunnerOrganisationWrongTypeError extends NotAcceptableError {
@IsString()
name = "RunnerOrganisationWrongTypeError"
@IsString()
message = "The runner organisation must be either a existing organisation, new organisation or a existing organisation's id. \n You provided a object of another type."
}

View File

@@ -36,4 +36,16 @@ export class RunnerTeamHasRunnersError extends NotAcceptableError {
@IsString()
message = "This team still has runners associated with it. \n If you want to delete this team with all it's runners and teams ass `?force` to your query."
}
/**
* Error to throw when a team still has runners associated.
* Implemented this waysto work with the json-schema conversion for openapi.
*/
export class RunnerTeamNeedsParentError extends NotAcceptableError {
@IsString()
name = "RunnerTeamNeedsParentError"
@IsString()
message = "You provided no runner organisation as this team's parent group."
}