57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { IsString } from 'class-validator';
|
|
import { BadRequestError } from 'routing-controllers';
|
|
|
|
/**
|
|
* Error to throw when an address's postal code fails validation.
|
|
*/
|
|
export class AddressPostalCodeInvalidError extends BadRequestError {
|
|
@IsString()
|
|
name = "AddressPostalCodeInvalidError"
|
|
|
|
@IsString()
|
|
message = "The postal code you provided is invalid. \n Please check if your postal code follows the postal code validation guidelines."
|
|
}
|
|
|
|
/**
|
|
* Error to throw when an non-empty address's first line isn't set.
|
|
*/
|
|
export class AddressFirstLineEmptyError extends BadRequestError {
|
|
@IsString()
|
|
name = "AddressFirstLineEmptyError"
|
|
|
|
@IsString()
|
|
message = "You provided a empty first address line. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when an non-empty address's postal code isn't set.
|
|
*/
|
|
export class AddressPostalCodeEmptyError extends BadRequestError {
|
|
@IsString()
|
|
name = "AddressPostalCodeEmptyError"
|
|
|
|
@IsString()
|
|
message = "You provided a empty postal code. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when an non-empty address's city isn't set.
|
|
*/
|
|
export class AddressCityEmptyError extends BadRequestError {
|
|
@IsString()
|
|
name = "AddressCityEmptyError"
|
|
|
|
@IsString()
|
|
message = "You provided a empty city. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
|
|
}
|
|
|
|
/**
|
|
* Error to throw when an non-empty address's country isn't set.
|
|
*/
|
|
export class AddressCountryEmptyError extends BadRequestError {
|
|
@IsString()
|
|
name = "AddressCountryEmptyError"
|
|
|
|
@IsString()
|
|
message = "You provided a empty country. \n If you want an empty address please set all propertys to null. \n For non-empty addresses the following fields have to be set: address1, postalcode, city, country"
|
|
} |