fixed notification system and added a new tenant notifications receipt table to track read status and filter messages by scope.

This commit is contained in:
Codex Agent
2025-12-17 10:57:19 +01:00
parent 0aae494945
commit d64839ba2f
31 changed files with 1089 additions and 127 deletions

View File

@@ -1,12 +1,13 @@
import type { EventAddonCatalogItem } from '../api';
export const scopeDefaults: Record<'photos' | 'gallery', string[]> = {
export const scopeDefaults: Record<'photos' | 'gallery' | 'guests', string[]> = {
photos: ['extra_photos_500', 'extra_photos_2000'],
gallery: ['extend_gallery_30d', 'extend_gallery_90d'],
guests: ['extra_guests_300', 'extra_guests_100', 'extra_guests_50', 'extra_guests'],
};
export function selectAddonKeyForScope(addons: EventAddonCatalogItem[], scope: 'photos' | 'gallery'): string {
const fallback = scope === 'photos' ? 'extra_photos_500' : 'extend_gallery_30d';
export function selectAddonKeyForScope(addons: EventAddonCatalogItem[], scope: 'photos' | 'gallery' | 'guests'): string {
const fallback = scope === 'photos' ? 'extra_photos_500' : scope === 'gallery' ? 'extend_gallery_30d' : 'extra_guests';
const filtered = addons.filter((addon) => addon.price_id && scopeDefaults[scope].includes(addon.key));
if (filtered.length) {
return filtered[0].key;