feat: standardize OrderBy types and fix data model mismatches
- Update ae_types.ts with joined fields for deep layout loading - Fix OrderBy vs OrderBy[] type mismatch in API v2/v3 and generic CRUD - Apply 'as const' to order_by_li defaults in core/event libraries - Resolve type errors in reports_presenters and reports_files Svelte components
This commit is contained in:
@@ -69,7 +69,7 @@ interface GetAeObjLiForObjIdCrudV2Params {
|
||||
inc?: key_val;
|
||||
enabled?: 'all' | 'enabled' | 'not_enabled';
|
||||
hidden?: 'all' | 'hidden' | 'not_hidden';
|
||||
order_by_li?: OrderBy[] | null;
|
||||
order_by_li?: OrderBy | OrderBy[] | null;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
headers?: Record<string, string>;
|
||||
|
||||
@@ -95,7 +95,7 @@ interface GetAeObjLiV3Params {
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[] | null;
|
||||
delay_ms?: number;
|
||||
log_lvl?: number;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ interface GetNestedObjLiV3Params {
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[] | null;
|
||||
delay_ms?: number;
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function load_ae_obj_li__country({
|
||||
hidden = 'not_hidden',
|
||||
limit = 299,
|
||||
offset = 0,
|
||||
order_by_li = { sort: 'DESC', english_short_name: 'ASC', alpha_2_code: 'ASC' },
|
||||
order_by_li = { sort: 'DESC', english_short_name: 'ASC', alpha_2_code: 'ASC' } as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function load_ae_obj_li__country_subdivision({
|
||||
hidden = 'not_hidden',
|
||||
limit = 399,
|
||||
offset = 0,
|
||||
order_by_li = { sort: 'DESC', name: 'ASC', code: 'ASC' },
|
||||
order_by_li = { sort: 'DESC', name: 'ASC', code: 'ASC' } as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -42,7 +42,7 @@ export interface GenericCrudArgs {
|
||||
hidden?: 'not_hidden' | 'hidden' | 'all';
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: key_val;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[] | null;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
|
||||
@@ -63,7 +63,12 @@ export async function load_ae_obj_li__hosted_file({
|
||||
hidden = 'not_hidden',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
|
||||
order_by_li = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function load_ae_obj_li__time_zone({
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
// order_by_li = {'priority': 'DESC', 'group': 'ASC', 'sort': 'DESC', 'name': 'ASC'},
|
||||
order_by_li = { priority: 'DESC', sort: 'DESC', name: 'ASC' },
|
||||
order_by_li = { priority: 'DESC', sort: 'DESC', name: 'ASC' } as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -112,7 +112,7 @@ export async function load_ae_obj_li__event({
|
||||
view = 'default',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = { start_datetime: 'DESC' },
|
||||
order_by_li = { start_datetime: 'DESC' } as const,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
@@ -328,7 +328,7 @@ export async function qry_ae_obj_li__event({
|
||||
view = 'default',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = { start_datetime: 'DESC' },
|
||||
order_by_li = { start_datetime: 'DESC' } as const,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
|
||||
@@ -235,7 +235,13 @@ export async function load_ae_obj_li__event_badge_template({
|
||||
hidden = 'not_hidden',
|
||||
limit = 49,
|
||||
offset = 0,
|
||||
order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
|
||||
order_by_li = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -475,7 +481,7 @@ export async function search__event_badge_template({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -119,7 +119,7 @@ export async function load_ae_obj_li__event_device({
|
||||
code: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -547,7 +547,7 @@ export async function search__event_device({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
};
|
||||
} as const;
|
||||
|
||||
// ae_promises.load__event_device_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.load__event_device_obj_li = await api
|
||||
|
||||
@@ -86,7 +86,12 @@ export async function load_ae_obj_li__event_file({
|
||||
hidden = 'not_hidden',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = { priority: 'DESC', sort: 'DESC', updated_on: 'DESC', created_on: 'DESC' },
|
||||
order_by_li = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -397,7 +402,7 @@ export async function qry__event_file({
|
||||
filename: 'ASC',
|
||||
extension: 'ASC',
|
||||
hosted_file_size: 'ASC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -541,7 +546,7 @@ export async function search__event_file({
|
||||
filename: 'ASC',
|
||||
extension: 'ASC',
|
||||
hosted_file_size: 'ASC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -656,7 +656,7 @@ export async function search__event_location({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
};
|
||||
} as const;
|
||||
|
||||
// ae_promises.load__event_location_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
ae_promises.load__event_location_obj_li = await api
|
||||
|
||||
@@ -185,7 +185,7 @@ export async function load_ae_obj_li__event_presentation({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -137,7 +137,7 @@ export async function load_ae_obj_li__event_presenter({
|
||||
family_name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -520,7 +520,7 @@ export async function search__event_presenter({
|
||||
email: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -187,7 +187,7 @@ export async function load_ae_obj_li__event_session({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -608,7 +608,7 @@ export async function qry__event_session({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -797,7 +797,7 @@ export async function search__event_session({
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
|
||||
@@ -101,6 +101,16 @@ export interface ae_SiteDomain extends ae_BaseObj {
|
||||
redirect_to_primary?: boolean;
|
||||
|
||||
access_key?: string;
|
||||
|
||||
// Joined fields for bootstrap lookup
|
||||
account_code?: string;
|
||||
account_name?: string;
|
||||
header_image_path?: string;
|
||||
style_href?: string;
|
||||
google_tracking_id?: string;
|
||||
access_code_kv_json?: any;
|
||||
cfg_json?: any;
|
||||
site_domain_access_key?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,6 +417,10 @@ export interface ae_Event extends ae_BaseObj {
|
||||
|
||||
cfg_json?: any;
|
||||
data_json?: any;
|
||||
|
||||
// Joined view fields
|
||||
event_location_obj_li?: ae_EventLocation[];
|
||||
event_session_obj_li?: ae_EventSession[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -537,6 +551,9 @@ export interface ae_EventSession extends ae_BaseObj {
|
||||
ready?: boolean;
|
||||
|
||||
data_json?: any;
|
||||
|
||||
// Joined fields
|
||||
event_presentation_li?: ae_EventPresentation[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -557,6 +574,9 @@ export interface ae_EventPresentation extends ae_BaseObj {
|
||||
|
||||
passcode?: string;
|
||||
file_count?: number;
|
||||
|
||||
// Joined fields
|
||||
event_presenter_li?: ae_EventPresenter[];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { lookup_site_domain } from '$lib/ae_core/ae_core__site';
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import type { ae_SiteDomain } from '$lib/types/ae_types';
|
||||
|
||||
import {
|
||||
PUBLIC_AE_API_PROTOCOL,
|
||||
|
||||
@@ -232,15 +232,15 @@
|
||||
order_by_li = rpt__order_by_li,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
created_on_offset?: string | null;
|
||||
created_on_offset?: string | number | null;
|
||||
min_file_size?: number | null;
|
||||
file_purpose?: string | null;
|
||||
// ft_search_str?: string,
|
||||
// lk_search_str?: string,
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled' | string;
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | string;
|
||||
limit?: number;
|
||||
order_by_li?: key_val;
|
||||
order_by_li?: any;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
log_lvl = 2;
|
||||
@@ -260,7 +260,7 @@
|
||||
let created_on_str = null;
|
||||
if (created_on_offset) {
|
||||
// Calculate the datetime to pass based on the selected offset.
|
||||
let offset = created_on_offset ?? 0;
|
||||
let offset = Number(created_on_offset) ?? 0;
|
||||
|
||||
let current_datetime = new Date();
|
||||
console.log(`Current time:`, current_datetime);
|
||||
@@ -315,8 +315,8 @@
|
||||
qry_created_on: created_on_str,
|
||||
qry_min_file_size: min_file_size,
|
||||
qry_file_purpose: file_purpose,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
enabled: enabled as any,
|
||||
hidden: hidden as any,
|
||||
limit: limit,
|
||||
order_by_li: order_by_li,
|
||||
// try_cache: try_cache,
|
||||
@@ -324,6 +324,9 @@
|
||||
})
|
||||
.then(function (search_results) {
|
||||
// Processing the results from the search.
|
||||
if (!search_results) {
|
||||
search_results = [];
|
||||
}
|
||||
$events_sess.pres_mgmt.status_qry__search = 'processing';
|
||||
$events_sess.pres_mgmt.status_rpt[rpt__name] = 'processing';
|
||||
qry__status = 'processing';
|
||||
|
||||
@@ -182,8 +182,8 @@
|
||||
biography = null,
|
||||
ft_search_str = '',
|
||||
lk_search_str = '',
|
||||
enabled = rpt__hidden,
|
||||
hidden = rpt__enabled,
|
||||
enabled = rpt__enabled,
|
||||
hidden = rpt__hidden,
|
||||
limit = rpt__limit,
|
||||
order_by_li = rpt__order_by_li,
|
||||
// params = {
|
||||
@@ -200,10 +200,10 @@
|
||||
lk_search_str?: string;
|
||||
// search_delay?: number, // In milliseconds
|
||||
// max_tries?: number,
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled' | string;
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | string;
|
||||
limit?: number;
|
||||
order_by_li?: key_val; // Order by fields and directions.
|
||||
order_by_li?: any; // Order by fields and directions.
|
||||
// params?: key_val,
|
||||
// try_cache?: boolean,
|
||||
log_lvl?: number;
|
||||
@@ -236,8 +236,8 @@
|
||||
like_presentation_search_qry_str: lk_search_str,
|
||||
like_presenter_search_qry_str: lk_search_str,
|
||||
// external_event_id: $events_loc.pres_mgmt.default__external_registration_id,
|
||||
enabled: enabled,
|
||||
hidden: hidden,
|
||||
enabled: enabled as any,
|
||||
hidden: hidden as any,
|
||||
limit: limit,
|
||||
order_by_li: order_by_li,
|
||||
// try_cache: try_cache,
|
||||
@@ -245,6 +245,9 @@
|
||||
})
|
||||
.then(function (search_results) {
|
||||
// Processing the results from the search.
|
||||
if (!search_results) {
|
||||
search_results = [];
|
||||
}
|
||||
$events_sess.pres_mgmt.status_qry__search = 'processing';
|
||||
$events_sess.pres_mgmt.status_rpt[rpt__name] = 'processing';
|
||||
qry__status = 'processing';
|
||||
|
||||
@@ -4,6 +4,7 @@ console.log(`Events - [event_id] launcher +layout.ts start`);
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { browser } from '$app/environment';
|
||||
import { events_func } from '$lib/ae_events_functions';
|
||||
import type { ae_Event } from '$lib/types/ae_types';
|
||||
|
||||
export async function load({ params, parent, url }) {
|
||||
// route
|
||||
@@ -32,7 +33,7 @@ export async function load({ params, parent, url }) {
|
||||
// console.log(`TEST URL Params`, params);
|
||||
// console.log(`TEST URL`, url);
|
||||
|
||||
const load_event_obj = await events_func.load_ae_obj_id__event({
|
||||
const load_event_obj: ae_Event | null = await events_func.load_ae_obj_id__event({
|
||||
api_cfg: ae_acct.api,
|
||||
event_id: event_id,
|
||||
// inc_file_li: true,
|
||||
|
||||
Reference in New Issue
Block a user