Event edit and participant fixes

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-05-17 09:38:04 +02:00
parent e96dcc42b9
commit b5a5de5c0c
6 changed files with 110 additions and 90 deletions

View File

@@ -42,6 +42,7 @@ interface IEventEditJSON {
draft: boolean;
picture?: IMedia | { mediaId: string } | null;
attributedToId: string | null;
organizerActorId?: string;
onlineAddress?: string;
phoneAddress?: string;
physicalAddress?: IAddress;
@@ -209,8 +210,8 @@ export class EventModel implements IEvent {
tags: this.tags.map((t) => t.title),
onlineAddress: this.onlineAddress,
phoneAddress: this.phoneAddress,
physicalAddress: this.physicalAddress,
options: this.options,
physicalAddress: this.removeTypeName(this.physicalAddress),
options: this.removeTypeName(this.options),
attributedToId:
this.attributedTo && this.attributedTo.id ? this.attributedTo.id : null,
contacts: this.contacts.map(({ id }) => ({
@@ -218,4 +219,13 @@ export class EventModel implements IEvent {
})),
};
}
private removeTypeName(entity: any): any {
if (entity?.__typename) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { __typename, ...purgedEntity } = entity;
return purgedEntity;
}
return entity;
}
}