All checks were successful
		
		
	
	Playwright Tests / test (pull_request) Has been skipped
				
			Check usage of free licenses / build-static-assets (pull_request) Successful in 1m12s
				
			Add copyright notice / copyright_notice (pull_request) Successful in 1m32s
				
			Build Nginx-based docker image / build-static-assets (push) Successful in 6m2s
				
			
		
			
				
	
	
		
			64 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
 | |
| 
 | |
| import { Entity } from "./definitions";
 | |
| 
 | |
| export type AttendanceSummary = {
 | |
|   considered: number;
 | |
|   invited: number;
 | |
|   confirmed: number;
 | |
|   declined: number;
 | |
|   tentative: number;
 | |
|   total: number;
 | |
| }
 | |
| 
 | |
| export class Group implements Entity {
 | |
|   id?: string;
 | |
|   name?: string;
 | |
|   guest_count?: number;
 | |
|   icon?: string;
 | |
|   children?: Group[];
 | |
|   parentId?: string;
 | |
|   color?: string;
 | |
|   attendance?: AttendanceSummary
 | |
| 
 | |
|   constructor(id?: string, name?: string, guest_count?: number, icon?: string, children?: Group[], parentId?: string, color?: string, attendance?: AttendanceSummary) {
 | |
|     this.id = id;
 | |
|     this.name = name;
 | |
|     this.guest_count = guest_count;
 | |
|     this.icon = icon;
 | |
|     this.children = children;
 | |
|     this.parentId = parentId;
 | |
|     this.color = color;
 | |
|     this.attendance = attendance;
 | |
|   }
 | |
| }
 | |
| 
 | |
| export class GroupSerializer {
 | |
|   fromJson(data: any): Group {
 | |
|     return new Group(
 | |
|       data.id,
 | |
|       data.name,
 | |
|       data.guest_count,
 | |
|       data.icon,
 | |
|       data.children,
 | |
|       data.parent_id,
 | |
|       data.color,
 | |
|       data.attendance
 | |
|     );
 | |
|   }
 | |
| 
 | |
|   toJson(group: Group): string {
 | |
|     return JSON.stringify({
 | |
|       group: {
 | |
|         name: group.name,
 | |
|         color: group.color,
 | |
|         icon: group.icon,
 | |
|         parent_id: group.parentId
 | |
|       }
 | |
|     });
 | |
|   }
 | |
| 
 | |
|   apiPath(): string {
 | |
|     return 'groups';
 | |
|   }
 | |
| } |