Creating standardized functions. Mainly for create and delete.

This commit is contained in:
Scott Idem
2024-11-08 12:47:24 -05:00
parent 4fe04d9c3f
commit 13d906428b
17 changed files with 855 additions and 276 deletions

View File

@@ -339,6 +339,65 @@ export async function create_ae_obj__event_location(
}
// Updated 2024-11-08
export async function delete_ae_obj_id__event_location(
{
api_cfg,
event_location_id,
method = 'delete', // 'delete', 'disable', 'hide'
params = {},
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
event_location_id: string,
method?: string,
params?: key_val,
try_cache?: boolean,
log_lvl?: number
}
) {
if (log_lvl) {
console.log(`*** delete_ae_obj_id__event_location() *** event_location_id=${event_location_id}`);
}
ae_promises.delete__event_location_obj = await api.delete_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'event_location',
obj_id: event_location_id,
key: api_cfg.api_crud_super_key,
params: params,
method: method,
log_lvl: log_lvl
})
.then(function (event_location_obj_delete_result) {
// if (event_location_obj_delete_result) {
// // db_save_ae_obj_li__event_location({obj_type: 'event_location', obj_li: [event_location_obj_delete_result]});
// return event_location_obj_delete_result;
// } else {
// return null;
// }
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
if (try_cache) {
if (log_lvl) {
console.log(`Attempting to remove IDB entry for event_location_id=${event_location_id}`);
}
db_events.locations.delete(event_location_id);
}
});
if (log_lvl) {
console.log('ae_promises.delete__event_location_obj:', ae_promises.delete__event_location_obj);
}
return ae_promises.delete__event_location_obj;
}
// Updated 2024-09-25
export async function update_ae_obj__event_location(
{