Cleanup: Renamed the creation folder to the more fitting "actions"

ref #11 #13
This commit is contained in:
2020-12-05 18:45:47 +01:00
parent 5c259484ee
commit 0e924449d6
21 changed files with 32 additions and 9 deletions

View File

@@ -0,0 +1,64 @@
import { IsNotEmpty, IsOptional, IsPostalCode, IsString } from 'class-validator';
import { Address } from '../entities/Address';
export class CreateAddress {
/**
* The address's description.
*/
@IsString()
@IsOptional()
description?: string;
/**
* The address's first line.
* Containing the street and house number.
*/
@IsString()
@IsNotEmpty()
address1: string;
/**
* The address's second line.
* Containing optional information.
*/
@IsString()
@IsOptional()
address2?: string;
/**
* The address's postal code.
*/
@IsString()
@IsNotEmpty()
@IsPostalCode("DE")
postalcode: string;
/**
* The address's city.
*/
@IsString()
@IsNotEmpty()
city: string;
/**
* The address's country.
*/
@IsString()
@IsNotEmpty()
country: string;
/**
* Creates a Address object based on this.
*/
public toAddress(): Address {
let newAddress: Address = new Address();
newAddress.address1 = this.address1;
newAddress.address2 = this.address2;
newAddress.postalcode = this.postalcode;
newAddress.city = this.city;
newAddress.country = this.country;
return newAddress;
}
}