Added address to contact response

ref #104
This commit is contained in:
Nicolai Ort 2021-01-19 17:13:46 +01:00
parent 703b4f89a6
commit 09e429fc67

View File

@ -1,4 +1,5 @@
import { IsInt, IsString } from "class-validator"; import { IsInt, IsObject, IsString } from "class-validator";
import { Address } from '../entities/Address';
import { GroupContact } from '../entities/GroupContact'; import { GroupContact } from '../entities/GroupContact';
import { ResponseRunnerGroup } from './ResponseRunnerGroup'; import { ResponseRunnerGroup } from './ResponseRunnerGroup';
@ -45,9 +46,15 @@ export class ResponseGroupContact {
/** /**
* The contact's associated runner groups. * The contact's associated runner groups.
*/ */
@IsObject()
groups: ResponseRunnerGroup[]; groups: ResponseRunnerGroup[];
//TODO: Address /**
* The contact's address.
* This is a address object to prevent any formatting differences.
*/
@IsObject()
address?: Address;
/** /**
* Creates a ResponseGroupContact object from a contact. * Creates a ResponseGroupContact object from a contact.
@ -60,6 +67,7 @@ export class ResponseGroupContact {
this.lastname = contact.lastname; this.lastname = contact.lastname;
this.phone = contact.phone; this.phone = contact.phone;
this.email = contact.email; this.email = contact.email;
this.address = contact.address;
for (let group of contact.groups) { for (let group of contact.groups) {
this.groups.push(group.toResponse()); this.groups.push(group.toResponse());
} }