feat(events): reorganize badge admin tools and enhance dependency tracking

- Migrated 'Add New Badge' and 'Upload Badge List' to centralized Event Settings hub.
- Secured Admin Tools visibility with Administrator access and Edit Mode requirements.
- Restored and modernized Badge Template management route with Svelte 5 runes.
- Patched 'Archive' and 'Session' database interfaces to resolve compiler errors.
- Added project-wide dependency comments to key interfaces (Archive, Badge, Session) to prevent cascading change regressions.
- Fixed duplicate import errors in the Settings page.
This commit is contained in:
Scott Idem
2026-02-04 14:04:44 -05:00
parent 49f0a888b0
commit bc30724628
19 changed files with 299 additions and 276 deletions

View File

@@ -10,9 +10,17 @@ import { load_ae_obj_id__event_badge_template } from '$lib/ae_events/ae_events__
const ae_promises: key_val = {};
// Updated 2026-01-02
/**
* load_ae_obj_id__event_badge - Load a single event badge by ID
* Related Files:
* - src/lib/ae_events/db_events.ts (Dexie Interface)
* - src/routes/events/[event_id]/(badges)/badges/[badge_id]/+page.svelte (View)
* - src/routes/events/[event_id]/settings/+page.svelte (Admin Operations)
*/
export async function load_ae_obj_id__event_badge({
api_cfg,
event_badge_id,
event_id, // This event_id should not be needed here... 2026-02-04
view = 'base',
inc_template = true,
try_cache = true,
@@ -20,6 +28,7 @@ export async function load_ae_obj_id__event_badge({
}: {
api_cfg: any;
event_badge_id: string;
event_id?: string;
view?: string;
inc_template?: boolean;
try_cache?: boolean;
@@ -41,8 +50,12 @@ export async function load_ae_obj_id__event_badge({
if (ae_promises.load__event_badge_obj) {
if (try_cache) {
// In theory we should be able to use the event_id found in the Badge load object. 2026-02-04
// This keeps coming up as undefined: ae_promises.load__event_badge_obj.event_id_random
if (log_lvl) console.log(`Saving to local cache... Event ID: ${event_id} or ${ae_promises.load__event_badge_obj.event_id_random}`);
const processed_obj_li = await process_ae_obj__event_badge_props({
obj_li: [ae_promises.load__event_badge_obj],
event_id: event_id || ae_promises.load__event_badge_obj.event_id_random,
log_lvl
});
await db_save_ae_obj_li__ae_obj({
@@ -603,6 +616,9 @@ export async function process_ae_obj__event_badge_props({
obj_type: 'event_badge',
log_lvl,
specific_processor: (obj) => {
if (log_lvl) {
console.log(`*** process_ae_obj__event_badge_props() *** event_id=${event_id}`);
}
if (event_id) {
if (!obj.event_id) obj.event_id = event_id;
if (!obj.event_id_random) obj.event_id_random = event_id;