fix: Consolidate type and parameter fixes across multiple modules
- API: Standardized 'order_by_li' types in event and archive modules. - API: Corrected 'enabled'/'hidden' parameter types in event exhibit and device search/list functions. - Type Safety: Addressed generic type casting issues in _process_generic_props across event modules. - Data Handling: Resolved return type consistency in journal creation and DB save operations. - Parameter Management: Fixed missing 'try_cache' parameters in event exhibit functions. - Core Logic: Ensured correct object properties in DB put operations for hosted files.
This commit is contained in:
@@ -10,7 +10,7 @@ interface SearchAeObjV3Params {
|
||||
view?: string;
|
||||
for_obj_type?: string;
|
||||
for_obj_id?: string;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[] | null;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
delay_ms?: number;
|
||||
|
||||
@@ -545,14 +545,14 @@ async function update_ae_obj_id_crud_v2({
|
||||
`Not Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}; Account ID: ${api_cfg.account_id}`
|
||||
);
|
||||
patch_result = 'PATCH failed';
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
return true;
|
||||
return null;
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('Something went wrong patching the record.');
|
||||
console.log(error);
|
||||
return false;
|
||||
return null;
|
||||
})
|
||||
.finally(function () {
|
||||
console.log('PATCH Promise finally');
|
||||
|
||||
@@ -141,7 +141,7 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
for (const key in processed_obj) {
|
||||
if (key.endsWith('_random')) {
|
||||
const newKey = key.slice(0, -7); // Remove '_random' suffix
|
||||
processed_obj[newKey] = processed_obj[key];
|
||||
(processed_obj as any)[newKey] = processed_obj[key];
|
||||
}
|
||||
}
|
||||
// Ensure 'id' is set from '[obj_type]_id_random'
|
||||
@@ -279,8 +279,8 @@ export async function load_ae_obj_li__exhibit({
|
||||
}): Promise<ae_EventExhibit[]> {
|
||||
console.log(`*** load_ae_obj_li__exhibit() *** event_id=${event_id}`);
|
||||
|
||||
const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
|
||||
const hidden: string = params.qry__hidden ?? 'not_hidden'; // all, hidden, not_hidden
|
||||
const enabled: 'enabled' | 'all' | 'not_enabled' = (params.qry__enabled as any) ?? 'enabled';
|
||||
const hidden: 'hidden' | 'all' | 'not_hidden' = (params.qry__hidden as any) ?? 'not_hidden';
|
||||
const limit: number = params.qry__limit ?? 99; // 99
|
||||
const offset: number = params.qry__offset ?? 0; // 0
|
||||
|
||||
@@ -458,8 +458,8 @@ export async function load_ae_obj_li__exhibit_tracking({
|
||||
}): Promise<ae_EventExhibitTracking[]> {
|
||||
console.log(`*** load_ae_obj_li__exhibit_tracking() *** exhibit_id=${exhibit_id}`);
|
||||
|
||||
const enabled: string = params.qry__enabled ?? 'enabled'; // all, disabled, enabled
|
||||
const hidden: string = params.qry__hidden ?? 'all'; // all, hidden, not_hidden
|
||||
const enabled: 'enabled' | 'all' | 'not_enabled' = (params.qry__enabled as any) ?? 'enabled';
|
||||
const hidden: 'hidden' | 'all' | 'not_hidden' = (params.qry__hidden as any) ?? 'all';
|
||||
const limit: number = params.qry__limit ?? 99; // 99
|
||||
const offset: number = params.qry__offset ?? 0; // 0
|
||||
|
||||
@@ -540,14 +540,16 @@ export async function create_ae_obj__exhibit_tracking({
|
||||
event_badge_id,
|
||||
external_person_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
exhibit_id: string;
|
||||
event_badge_id: string;
|
||||
external_person_id: string;
|
||||
params: key_val;
|
||||
log_lvl: number;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibitTracking | null> {
|
||||
console.log(
|
||||
`*** handle_create_ae_obj__exhibit_tracking() *** exhibit_id=${exhibit_id}, event_badge_id=${event_badge_id}`
|
||||
|
||||
@@ -308,7 +308,7 @@ export async function create_ae_obj__journal({
|
||||
|
||||
if (!account_id) {
|
||||
console.log(`ERROR: Journals - Journal - account_id required to create`);
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
ae_promises.create__journal = await api
|
||||
@@ -467,6 +467,14 @@ export async function qry__journal({
|
||||
hidden = 'not_hidden',
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
order_by_li = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
start_datetime: 'ASC',
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
} as const,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
@@ -480,6 +488,7 @@ export async function qry__journal({
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined; // all, hidden, not_hidden
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | Record<string, 'ASC' | 'DESC'>[];
|
||||
params?: any;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
@@ -525,15 +534,6 @@ export async function qry__journal({
|
||||
search_query.and.push({ field: 'hidden', op: 'eq', value: false });
|
||||
}
|
||||
|
||||
const order_by_li: Record<string, 'ASC' | 'DESC'> = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
start_datetime: 'ASC',
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
};
|
||||
|
||||
ae_promises.load__journal_obj_li = await api
|
||||
.search_ae_obj_v3({
|
||||
api_cfg: api_cfg,
|
||||
|
||||
3570
svelte_check_output.txt
Normal file
3570
svelte_check_output.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user