Hardening: Restore V3 Search legacy compatibility and fix Hosted File specialized delete logic
- Restored legacy query aliases (qry_ae_obj_li__event, qry__event_file, etc.) across Event modules to fix build errors.
- Fixed Hosted File deletion logic in core__hosted_files.ts to use specialized /hosted_file/{id} endpoint with fake_delete support.
- Standardized ID field usage (hosted_file_id vs hosted_file_id_random) in Archive Content and Event File upload components.
- Updated TODO.md to reflect completed search restoration tasks.
This commit is contained in:
@@ -70,6 +70,11 @@
|
||||
|
||||
let input_element_id = 'ae_comp__hosted_files_upload__input';
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`*** ae_comp__hosted_files_upload.svelte ***`);
|
||||
console.log(`link_to_type: ${link_to_type} link_to_id: ${link_to_id}`);
|
||||
}
|
||||
|
||||
// *** Functions and Logic
|
||||
async function handle_submit_form_files(event: SubmitEvent) {
|
||||
console.log('*** handle_submit_form() ***');
|
||||
@@ -191,18 +196,18 @@
|
||||
console.log(result[x]);
|
||||
let hosted_file_obj = result[x];
|
||||
|
||||
let hosted_file_id = hosted_file_obj.hosted_file_id_random;
|
||||
let hosted_file_id = hosted_file_obj.hosted_file_id;
|
||||
|
||||
hosted_file_id_li.push(hosted_file_id);
|
||||
hosted_file_obj_li.push(hosted_file_obj);
|
||||
|
||||
let hosted_file_data: key_val = {};
|
||||
hosted_file_data['id'] = hosted_file_id;
|
||||
hosted_file_data['id'] = hosted_file_id; // Same as the hosted_file_id
|
||||
hosted_file_data['hosted_file_id'] = hosted_file_id;
|
||||
hosted_file_data['hosted_file_id_random'] = hosted_file_id;
|
||||
// hosted_file_data['hosted_file_id_random'] = hosted_file_id;
|
||||
hosted_file_data['for_type'] = link_to_type;
|
||||
hosted_file_data['for_id'] = link_to_id;
|
||||
hosted_file_data['for_id_random'] = link_to_id;
|
||||
// hosted_file_data['for_id_random'] = link_to_id;
|
||||
hosted_file_data['hash_sha256'] = hosted_file_obj.hash_sha256;
|
||||
hosted_file_data['filename'] = hosted_file_obj.filename;
|
||||
hosted_file_data['extension'] = hosted_file_obj.extension;
|
||||
@@ -215,6 +220,10 @@
|
||||
|
||||
hosted_file_obj_kv[hosted_file_id] = hosted_file_data;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log(`hosted_file_data:`, hosted_file_data);
|
||||
}
|
||||
|
||||
return hosted_file_data;
|
||||
|
||||
// $ae_sess.files.new_upload_list[i].uploaded_bytes = 10; // fake 10 bytes at least...
|
||||
@@ -233,9 +242,9 @@
|
||||
|
||||
// return event_file_id;
|
||||
})
|
||||
.then(function (hosted_file_data) {
|
||||
return hosted_file_data;
|
||||
})
|
||||
// .then(function (hosted_file_data) {
|
||||
// return hosted_file_data;
|
||||
// })
|
||||
.catch(function (error: any) {
|
||||
console.log('Something went wrong.');
|
||||
console.log(error);
|
||||
@@ -245,7 +254,9 @@
|
||||
$slct_trigger = 'load__hosted_file_obj_li';
|
||||
});
|
||||
|
||||
console.log(ae_promises.upload__hosted_file_obj);
|
||||
if (log_lvl) {
|
||||
console.log(`Waiting for upload__hosted_file_obj promise...`);
|
||||
}
|
||||
let hosted_file_result = ae_promises.upload__hosted_file_obj;
|
||||
|
||||
return hosted_file_result;
|
||||
|
||||
@@ -138,13 +138,14 @@ export async function load_ae_obj_li__hosted_file({
|
||||
return ae_promises.load__hosted_file_obj_li || [];
|
||||
}
|
||||
|
||||
// Updated 2026-01-20 to V3
|
||||
// Updated 2026-01-22 to use special endpoint
|
||||
export async function delete_ae_obj_id__hosted_file({
|
||||
api_cfg,
|
||||
hosted_file_id,
|
||||
link_to_type,
|
||||
link_to_id,
|
||||
rm_orphan = false,
|
||||
fake_delete = false,
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
@@ -153,15 +154,22 @@ export async function delete_ae_obj_id__hosted_file({
|
||||
link_to_type: string;
|
||||
link_to_id: string;
|
||||
rm_orphan?: boolean;
|
||||
fake_delete?: boolean;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
// V3 generic delete with orphan cleanup parameters
|
||||
const result = await api.delete_ae_obj_v3({
|
||||
if (log_lvl) {
|
||||
console.log(`*** delete_ae_obj_id__hosted_file() *** [Special] id=${hosted_file_id}`);
|
||||
}
|
||||
|
||||
// Use the specialized hosted file delete endpoint
|
||||
const result = await api.delete_hosted_file({
|
||||
api_cfg,
|
||||
obj_type: 'hosted_file',
|
||||
obj_id: hosted_file_id,
|
||||
params: { link_to_type, link_to_id, rm_orphan },
|
||||
hosted_file_id,
|
||||
link_to_type,
|
||||
link_to_id,
|
||||
rm_orphan,
|
||||
params: { fake_delete },
|
||||
log_lvl
|
||||
});
|
||||
|
||||
|
||||
@@ -575,6 +575,8 @@ export async function search__event({
|
||||
return filtered_obj_li;
|
||||
}
|
||||
|
||||
export const qry_ae_obj_li__event = search__event;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -451,6 +451,8 @@ export async function search__event_badge({
|
||||
return ae_promises.search__event_badge_obj_li;
|
||||
}
|
||||
|
||||
export const qry__event_badge = search__event_badge;
|
||||
|
||||
// Updated 2025-10-06
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
|
||||
@@ -330,6 +330,8 @@ export async function search__event_file({
|
||||
return result_li || [];
|
||||
}
|
||||
|
||||
export const qry__event_file = search__event_file;
|
||||
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
'event_file_id',
|
||||
|
||||
@@ -474,6 +474,8 @@ export async function search__event_session({
|
||||
return result_li || [];
|
||||
}
|
||||
|
||||
export const qry__event_session = search__event_session;
|
||||
|
||||
/**
|
||||
* Send sign-in link to POC
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user