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
				
			
		
			
				
	
	
		
			28 lines
		
	
	
		
			759 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			759 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
 | |
| 
 | |
| import { Entity } from "./definitions";
 | |
| import { Guest } from "./guest";
 | |
| 
 | |
| export class Invitation implements Entity {
 | |
|   id?: string;
 | |
|   guests: Array<Guest>;
 | |
| 
 | |
|   constructor(id?: string, guests: Array<Guest> = []) {
 | |
|     this.id = id;
 | |
|     this.guests = guests;
 | |
|   }
 | |
| }
 | |
| 
 | |
| export class InvitationSerializer {
 | |
|   fromJson(data: any): Invitation {
 | |
|     return new Invitation(data.id, (data.guests || []).map((guest: any) => new Guest(guest.id, guest.name, guest.color, guest.status, guest.children)));
 | |
|   }
 | |
| 
 | |
|   toJson(invitation: Invitation): string {
 | |
|     return JSON.stringify({ invitation: { guest_ids: invitation.guests.map(guest => guest.id) } });
 | |
|   }
 | |
| 
 | |
|   apiPath(): string {
 | |
|     return 'invitations';
 | |
|   }
 | |
| } |