Manuel Bustillo 7de37759ca
All checks were successful
Playwright Tests / test (pull_request) Has been skipped
Check usage of free licenses / build-static-assets (pull_request) Successful in 32s
Add copyright notice / copyright_notice (pull_request) Successful in 40s
Add copyright notice
2024-12-09 18:22:44 +00:00

41 lines
1.1 KiB
TypeScript

/* Copyright (C) 2024 Manuel Bustillo*/
import { Serializable } from "../api/abstract-api";
import { Entity } from "./definitions";
export const guestStatuses = ['considered', 'invited', 'confirmed', 'declined', 'tentative'] as const;
export type GuestStatus = typeof guestStatuses[number];
export class Guest implements Entity {
id?: string;
name?: string;
group_name?: string;
groupId?: string;
color?: string;
status?: GuestStatus;
constructor(id?: string, name?: string, group_name?: string, groupId?: string, color?: string, status?: GuestStatus) {
this.id = id;
this.name = name;
this.group_name = group_name;
this.groupId = groupId;
this.color = color;
this.status = status;
}
}
export class GuestSerializer implements Serializable<Guest> {
fromJson(data: any): Guest {
return new Guest(data.id, data.name, data.group_name, data.group_id, data.color, data.status);
}
toJson(guest: Guest): string {
return JSON.stringify({ guest: { name: guest.name, status: guest.status, group_id: guest.groupId } });
}
apiPath(): string {
return 'guests';
}
}