feat(packages): implement package-based business model

This commit is contained in:
Codex Agent
2025-09-26 22:13:56 +02:00
parent 6fc36ebaf4
commit 0a643c3e4d
54 changed files with 3301 additions and 282 deletions

View File

@@ -14,6 +14,19 @@ export interface EventData {
};
}
export interface PackageData {
id: number;
name: string;
max_photos: number;
}
export interface EventPackage {
id: number;
used_photos: number;
expires_at: string;
package: PackageData;
}
export interface EventStats {
onlineGuests: number;
tasksSolved: number;
@@ -39,4 +52,13 @@ export async function fetchStats(slug: string): Promise<EventStats> {
tasksSolved: json.tasksSolved ?? 0,
latestPhotoAt: json.latestPhotoAt ?? null,
};
}
export async function getEventPackage(slug: string): Promise<EventPackage | null> {
const res = await fetch(`/api/v1/events/${slug}/package`);
if (!res.ok) {
if (res.status === 404) return null;
throw new Error('Failed to load event package');
}
return await res.json();
}