Now with a better file manager. It still needs work.

This commit is contained in:
Scott Idem
2024-06-27 18:19:29 -04:00
parent 37ac30c56c
commit 12c778c7e2
5 changed files with 226 additions and 95 deletions

View File

@@ -211,6 +211,55 @@ export async function create_event_file_obj_from_hosted_file_async(
}
// Updated 2024-06-13
export async function handle_update_ae_obj__event_file(
{
api_cfg,
event_file_id,
data_kv,
params={},
log_lvl=0
}: {
api_cfg: any,
event_file_id: string,
data_kv: any,
params?: key_val,
log_lvl?: number
}
) {
console.log(`*** handle_update_ae_obj__event_file() *** event_file_id=${event_file_id}`);
ae_promises.update__event_file_obj = await api.update_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'event_file',
obj_id: event_file_id, // NOTE: This is the FQDN, not normally the ID.
fields: data_kv,
key: api_cfg.api_crud_super_key,
params: params,
return_obj: true,
log_lvl: log_lvl
})
.then(function (event_file_obj_update_result) {
if (event_file_obj_update_result) {
handle_db_save_ae_obj_li__event_file({obj_type: 'event_file', obj_li: [event_file_obj_update_result]});
return event_file_obj_update_result;
} else {
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
});
if (log_lvl) {
console.log('ae_promises.update__event_file_obj:', ae_promises.update__event_file_obj);
}
return ae_promises.update__event_file_obj;
}
// This function will loop through the event_file_obj_li and save each one to the DB.
export function handle_db_save_ae_obj_li__event_file(
{
@@ -284,4 +333,5 @@ export function handle_db_save_ae_obj_li__event_file(
return true;
}
return false;
}