Second part of the action comment refactoring
Some checks failed
continuous-integration/drone/pr Build is failing

ref #39
This commit is contained in:
2020-12-21 16:21:12 +01:00
parent 1d0d79f3da
commit 48bef8db60
12 changed files with 79 additions and 49 deletions

View File

@@ -5,32 +5,34 @@ import { AddressNotFoundError, AddressWrongTypeError } from '../../errors/Addres
import { Address } from '../entities/Address';
import { GroupContact } from '../entities/GroupContact';
/**
* This classed is used to create a new Group entity from a json body (post request).
*/
export class CreateGroupContact {
/**
* The contact's first name.
*/
* The new contact's first name.
*/
@IsNotEmpty()
@IsString()
firstname: string;
/**
* The contact's middle name.
* Optional
* The new contact's middle name.
*/
@IsOptional()
@IsString()
middlename?: string;
/**
* The contact's last name.
* The new contact's last name.
*/
@IsNotEmpty()
@IsString()
lastname: string;
/**
* The contact's address.
* Optional
* The new contact's address.
* Must be the address's id.
*/
@IsInt()
@IsOptional()
@@ -38,7 +40,7 @@ export class CreateGroupContact {
/**
* The contact's phone number.
* Optional
* This will be validated against the configured country phone numer syntax (default: international).
*/
@IsOptional()
@IsPhoneNumber(config.phone_validation_countrycode)
@@ -46,14 +48,13 @@ export class CreateGroupContact {
/**
* The contact's email address.
* Optional
*/
@IsOptional()
@IsEmail()
email?: string;
/**
* Get's this participant's address from this.address.
* Gets the new contact's address by it's id.
*/
public async getAddress(): Promise<Address> {
if (this.address === undefined || this.address === null) {
@@ -69,7 +70,7 @@ export class CreateGroupContact {
}
/**
* Creates a Address object based on this.
* Creates a new Address entity from this.
*/
public async toGroupContact(): Promise<GroupContact> {
let contact: GroupContact = new GroupContact();