parent
11af9c02d9
commit
de824375d3
@ -29,7 +29,7 @@ export class CreateGroupContact {
|
|||||||
lastname: string;
|
lastname: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The new contact's address.
|
* The new participant's address.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
@IsObject()
|
@IsObject()
|
||||||
@ -55,14 +55,14 @@ export class CreateGroupContact {
|
|||||||
* Creates a new Address entity from this.
|
* Creates a new Address entity from this.
|
||||||
*/
|
*/
|
||||||
public async toEntity(): Promise<GroupContact> {
|
public async toEntity(): Promise<GroupContact> {
|
||||||
let contact: GroupContact = new GroupContact();
|
let newContact: GroupContact = new GroupContact();
|
||||||
contact.firstname = this.firstname;
|
newContact.firstname = this.firstname;
|
||||||
contact.middlename = this.middlename;
|
newContact.middlename = this.middlename;
|
||||||
contact.lastname = this.lastname;
|
newContact.lastname = this.lastname;
|
||||||
contact.email = this.email;
|
newContact.email = this.email;
|
||||||
contact.phone = this.phone;
|
newContact.phone = this.phone;
|
||||||
contact.address = this.address;
|
newContact.address = this.address;
|
||||||
Address.validate(contact.address);
|
Address.validate(newContact.address);
|
||||||
return contact;
|
return newContact;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,4 @@
|
|||||||
import {
|
import {
|
||||||
IsNotEmpty,
|
|
||||||
IsOptional,
|
|
||||||
IsPostalCode,
|
IsPostalCode,
|
||||||
IsString
|
IsString
|
||||||
} from "class-validator";
|
} from "class-validator";
|
||||||
@ -18,10 +16,9 @@ export class Address {
|
|||||||
* The address's first line.
|
* The address's first line.
|
||||||
* Containing the street and house number.
|
* Containing the street and house number.
|
||||||
*/
|
*/
|
||||||
@Column()
|
@Column({ nullable: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
address1?: string;
|
||||||
address1: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address's second line.
|
* The address's second line.
|
||||||
@ -29,33 +26,29 @@ export class Address {
|
|||||||
*/
|
*/
|
||||||
@Column({ nullable: true })
|
@Column({ nullable: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsOptional()
|
|
||||||
address2?: string;
|
address2?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address's postal code.
|
* The address's postal code.
|
||||||
* This will get checked against the postal code syntax for the configured country.
|
* This will get checked against the postal code syntax for the configured country.
|
||||||
*/
|
*/
|
||||||
@Column()
|
@Column({ nullable: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
|
||||||
@IsPostalCode(config.postalcode_validation_countrycode)
|
@IsPostalCode(config.postalcode_validation_countrycode)
|
||||||
postalcode: string;
|
postalcode: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address's city.
|
* The address's city.
|
||||||
*/
|
*/
|
||||||
@Column()
|
@Column({ nullable: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
|
||||||
city: string;
|
city: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The address's country.
|
* The address's country.
|
||||||
*/
|
*/
|
||||||
@Column()
|
@Column({ nullable: true })
|
||||||
@IsString()
|
@IsString()
|
||||||
@IsNotEmpty()
|
|
||||||
country: string;
|
country: string;
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
|
@ -54,7 +54,6 @@ export class GroupContact {
|
|||||||
* The contact's address.
|
* The contact's address.
|
||||||
* This is a address object to prevent any formatting differences.
|
* This is a address object to prevent any formatting differences.
|
||||||
*/
|
*/
|
||||||
@IsOptional()
|
|
||||||
@Column(type => Address)
|
@Column(type => Address)
|
||||||
address?: Address;
|
address?: Address;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user