All checks were successful
		
		
	
	Check usage of free licenses / build-static-assets (pull_request) Successful in 33s
				
			Add copyright notice / copyright_notice (pull_request) Successful in 53s
				
			Playwright Tests / test (pull_request) Successful in 5m42s
				
			Build Nginx-based docker image / build-static-assets (push) Successful in 6m11s
				
			
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
 | |
| 
 | |
| import { Serializable } from "../api/abstract-api";
 | |
| import { Entity } from "./definitions";
 | |
| import { Group } from "./group";
 | |
| 
 | |
| 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;
 | |
|   color?: string;
 | |
|   status?: GuestStatus;
 | |
|   children?: Guest[];
 | |
|   group?: Group;
 | |
| 
 | |
|   constructor(id?: string, name?: string, color?: string, status?: GuestStatus, children?: Guest[], Group?: Group) {
 | |
|     this.id = id;
 | |
|     this.name = name;
 | |
|     this.color = color;
 | |
|     this.status = status;
 | |
|     this.children = children;
 | |
|     this.group = Group;
 | |
|   }
 | |
| }
 | |
| 
 | |
| export class GuestSerializer implements Serializable<Guest> {
 | |
|   fromJson(data: any): Guest {
 | |
|     return new Guest(data.id, data.name, data.color, data.status, data.children, new Group(data.group?.id, data.group?.name));
 | |
|   }
 | |
| 
 | |
|   toJson(guest: Guest): string {
 | |
|     return JSON.stringify({ guest: { name: guest.name, status: guest.status, group_id: guest.group?.id } });
 | |
|   }
 | |
| 
 | |
|   apiPath(): string {
 | |
|     return 'guests';
 | |
|   }
 | |
| }
 | |
| 
 |