chore(api): remove legacy CRUD wrappers and dead commented code
Deleted `delete_ae_obj_id_crud` from api.ts (last legacy export, no callers) and purged ~200 lines of commented-out dead functions from ae_core_functions.ts (`load_ae_obj_id__site_domain`, `update_ae_obj_id_crud`, `update_ae_obj_id_crud_v2`). V3 CRUD migration is now 100% complete with no legacy remnants. TODO updated. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -55,11 +55,10 @@ Axonius DC (June 9) is done — the show happened and the badge layout work that
|
||||
|
||||
---
|
||||
|
||||
## 🚧 V3 CRUD Migration (Surgical Cleanup)
|
||||
Finalizing the 100% adoption of V3 Standard endpoints and retirement of legacy wrappers.
|
||||
## ✅ V3 CRUD Migration (complete 2026-06-23)
|
||||
|
||||
- [ ] **[Core] Legacy Utility Helpers** — Refactor `ae_core_functions.ts` to use V3 helpers.
|
||||
- [ ] **[Cleanup] Delete Legacy Wrappers** — Once all callsites are migrated, remove `src/lib/ae_api/api_get__crud_obj_id.ts` and the legacy exports from `api.ts`.
|
||||
- [x] **[Core] Legacy Utility Helpers** — `ae_core_functions.ts` confirmed using V3 helpers throughout; three commented-out dead functions (`load_ae_obj_id__site_domain`, `update_ae_obj_id_crud`, `update_ae_obj_id_crud_v2`) removed (2026-06-23).
|
||||
- [x] **[Cleanup] Delete Legacy Wrappers** — `api_get__crud_obj_id.ts` already absent; `delete_ae_obj_id_crud` (last legacy export in `api.ts`) removed; commented dead code in `ae_core_functions.ts` purged. 271 lines deleted, 0 callers (2026-06-23).
|
||||
|
||||
---
|
||||
|
||||
@@ -119,7 +118,7 @@ Sorting baseline is now `build_tmp_sort` (ASC chain, no `.reverse()` on tmp-sort
|
||||
|
||||
## ⚙️ DevOps & Backend
|
||||
|
||||
- [ ] **[Cleanup] Remove unused legacy API wrappers** — `create_ae_obj_crud()`, `get_ae_obj_id_crud()`, and `update_ae_obj_id_crud()` are still exported from `api.ts` but no longer called anywhere in production code. V3 migration is 100% complete. Safe to delete: definitions in `api.ts` (lines 109-260), `src/lib/ae_api/api_get__crud_obj_id.ts`, unused wrapper in `ae_core_functions.ts` (`get_site_domain_obj_from_fqdn`, `update_ae_obj_id_crud`).
|
||||
- [x] **[Cleanup] Remove unused legacy API wrappers** — Complete (2026-06-23). See V3 CRUD Migration section above.
|
||||
- [ ] **[Backend] `event_file` — add `cfg_json` column (post-CMSC)** — The per-file display override currently uses a localStorage workaround (`launcher_loc.current.file_display_overrides`) because `event_file` has no JSON blob column. Proper fix: add `cfg_json` to the `event_file` DB table, expose it through the FastAPI model, then migrate the frontend back to reading/writing the backend field (restoring global/cross-device persistence). Frontend code is in `launcher_file_cont.svelte` — search for `file_display_overrides`.
|
||||
- [x] **[Backend] Hosted file delete — V3 CRUD regression fix** — `DELETE /v3/action/event_file/{id}` now handles atomic cleanup (link removal, physical file, hosted_file record). Frontend updated to use this endpoint directly (2026-06-18, commit `5689bfebb`).
|
||||
- [x] **[Backend] Hosted file orphan scan endpoint** — `GET /v3/action/hosted_file/orphan_scan` live. `/core/files/` "Check Orphans" updated to use it — single call replaces N+1 per-file link fetches (2026-06-18, commit `5689bfebb`).
|
||||
|
||||
@@ -104,73 +104,6 @@ export const get_ae_obj_li_for_lu = async function get_ae_obj_li_for_lu({
|
||||
}
|
||||
};
|
||||
|
||||
// Updated 2023-11-14
|
||||
export const delete_ae_obj_id_crud = async function delete_ae_obj_id_crud({
|
||||
api_cfg,
|
||||
obj_type,
|
||||
obj_id,
|
||||
key,
|
||||
jwt = null,
|
||||
headers = {},
|
||||
params = {},
|
||||
data = {},
|
||||
method = 'delete', // 'delete', 'disable', 'hide'
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
obj_type: string;
|
||||
obj_id: string;
|
||||
key: string;
|
||||
jwt?: null | string;
|
||||
headers?: any;
|
||||
params?: any;
|
||||
data?: any;
|
||||
method?: string;
|
||||
return_meta?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** delete_ae_obj_id_crud() *** obj_type: ${obj_type} obj_id: ${obj_id}`
|
||||
);
|
||||
}
|
||||
|
||||
data['super_key'] = key;
|
||||
data['jwt'] = jwt;
|
||||
// NOTE: The key and or JWT should be in the header of the DELETE, GET, PATCH, POST
|
||||
|
||||
// V3 Standard: Unified endpoint for all objects
|
||||
const endpoint = `/v3/crud/${obj_type}/${obj_id}`;
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Endpoint:', endpoint);
|
||||
}
|
||||
|
||||
if (method) {
|
||||
// NOTE: method options: 'delete', 'disable', 'hide'
|
||||
params['method'] = method;
|
||||
}
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
const object_obj_delete_promise = await delete_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
data: data,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (log_lvl > 1) {
|
||||
console.log(object_obj_delete_promise);
|
||||
}
|
||||
|
||||
return object_obj_delete_promise;
|
||||
};
|
||||
|
||||
/* BEGIN: Hosted File Related */
|
||||
|
||||
// Updated 2026-01-07
|
||||
@@ -395,7 +328,6 @@ const obj = {
|
||||
update_nested_obj: update_nested_obj,
|
||||
delete_ae_obj: delete_ae_obj,
|
||||
delete_nested_ae_obj: delete_nested_ae_obj,
|
||||
delete_ae_obj_id_crud: delete_ae_obj_id_crud,
|
||||
download_hosted_file: download_hosted_file,
|
||||
delete_hosted_file: delete_hosted_file,
|
||||
get_data_store: get_data_store,
|
||||
|
||||
@@ -47,208 +47,6 @@ import { add_url_params, clean_headers } from '$lib/ae_core/core__api_helpers';
|
||||
|
||||
import { download_export__obj_type } from '$lib/ae_core/core__export';
|
||||
|
||||
// DEAD CODE — no callers; pending removal. Updated 2024-03-29
|
||||
// async function load_ae_obj_id__site_domain({
|
||||
// api_cfg,
|
||||
// fqdn,
|
||||
// timeout = 7000,
|
||||
// log_lvl = 0
|
||||
// }: {
|
||||
// api_cfg: any;
|
||||
// fqdn: string;
|
||||
// timeout?: number;
|
||||
// log_lvl?: number;
|
||||
// }) {
|
||||
// if (log_lvl) {
|
||||
// console.log(
|
||||
// `*** load_ae_obj_id__site_domain() *** api.base_url=${api_cfg.base_url}, fqdn=${fqdn}, timeout=${timeout}`
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// let no_account_id = false;
|
||||
// if (!api_cfg.account_id) {
|
||||
// no_account_id = true;
|
||||
// }
|
||||
// // LEGACY BOOTSTRAP SPECIAL CASE: this helper is effectively a remove
|
||||
// // candidate once all site-domain lookups use the cache-first/bootstrap
|
||||
// // path in ae_core__site.ts.
|
||||
// no_account_id = true;
|
||||
//
|
||||
// const params = {};
|
||||
//
|
||||
// ae_promises.load__site_domain_obj = api
|
||||
// .get_ae_obj({
|
||||
// api_cfg: api_cfg,
|
||||
// obj_type: 'site_domain',
|
||||
// obj_id: fqdn,
|
||||
// params: params,
|
||||
// log_lvl: log_lvl
|
||||
// })
|
||||
// .then(function (site_domain_obj_get_result: any) {
|
||||
// if (site_domain_obj_get_result) {
|
||||
// return site_domain_obj_get_result;
|
||||
// } else {
|
||||
// console.log('No results returned.');
|
||||
// return null;
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error: any) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
//
|
||||
// return ae_promises.load__site_domain_obj;
|
||||
// }
|
||||
|
||||
// DEAD CODE — no callers; pending removal. Updated 2024-03-27
|
||||
// async function update_ae_obj_id_crud({
|
||||
// api_cfg,
|
||||
// object_type,
|
||||
// object_id,
|
||||
// object_reload = false,
|
||||
// field_name,
|
||||
// new_field_value,
|
||||
// params = {},
|
||||
// log_lvl = 0
|
||||
// }: {
|
||||
// api_cfg: any;
|
||||
// object_type: string;
|
||||
// object_id: string;
|
||||
// object_reload?: boolean;
|
||||
// field_name: string;
|
||||
// new_field_value: any;
|
||||
// params?: any | key_val;
|
||||
// log_lvl?: number;
|
||||
// }) {
|
||||
// let patch_result: any = null;
|
||||
//
|
||||
// ae_promises.api_update__ae_obj = api
|
||||
// .update_ae_obj({
|
||||
// api_cfg: api_cfg,
|
||||
// obj_type: object_type,
|
||||
// obj_id: object_id,
|
||||
// fields: { [field_name]: new_field_value },
|
||||
// log_lvl: log_lvl
|
||||
// })
|
||||
// .then(function (results: any) {
|
||||
// console.log('PATCH Promise', results);
|
||||
//
|
||||
// if (results) {
|
||||
// patch_result = 'PATCH complete';
|
||||
// } else {
|
||||
// patch_result = 'PATCH failed';
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// })
|
||||
// .catch(function (error: any) {
|
||||
// console.log('Something went wrong patching the record.');
|
||||
// console.log(error);
|
||||
// return false;
|
||||
// })
|
||||
// .finally(function () {
|
||||
// console.log('PATCH Promise finally');
|
||||
// });
|
||||
//
|
||||
// return ae_promises.api_update__ae_obj;
|
||||
// }
|
||||
|
||||
// // Core - Already imported above
|
||||
// // import { load_ae_obj_id__person } from "$lib/ae_core/core__person";
|
||||
// // import { load_ae_obj_id__user } from "$lib/ae_core/core__user";
|
||||
|
||||
// // Additional Modules
|
||||
// import { load_ae_obj_id__archive } from '$lib/ae_archives/ae_archives__archive';
|
||||
// import { load_ae_obj_id__archive_content } from '$lib/ae_archives/ae_archives__archive_content';
|
||||
|
||||
// import { load_ae_obj_id__event } from '$lib/ae_events/ae_events__event';
|
||||
// // import { load_ae_obj_id__event_badge } from "$lib/ae_events/ae_events__event_badge";
|
||||
// import { load_ae_obj_id__event_exhibit } from '$lib/ae_events/ae_events__exhibit';
|
||||
// import { load_ae_obj_id__event_device } from '$lib/ae_events/ae_events__event_device';
|
||||
// // import { load_ae_obj_id__event_exhibit } from "$lib/ae_events/ae_events__event_exhibit";
|
||||
// import { load_ae_obj_id__event_file } from '$lib/ae_events/ae_events__event_file';
|
||||
// import { load_ae_obj_id__event_location } from '$lib/ae_events/ae_events__event_location';
|
||||
// import { load_ae_obj_id__event_presentation } from '$lib/ae_events/ae_events__event_presentation';
|
||||
// import { load_ae_obj_id__event_presenter } from '$lib/ae_events/ae_events__event_presenter';
|
||||
// import { load_ae_obj_id__event_session } from '$lib/ae_events/ae_events__event_session';
|
||||
|
||||
// import { load_ae_obj_id__journal } from '$lib/ae_journals/ae_journals__journal';
|
||||
// import { load_ae_obj_id__journal_entry } from '$lib/ae_journals/ae_journals__journal_entry';
|
||||
|
||||
// import { load_ae_obj_id__post } from '$lib/ae_posts/ae_posts__post';
|
||||
// import { load_ae_obj_id__post_comment } from '$lib/ae_posts/ae_posts__post_comment';
|
||||
|
||||
// Updated 2025-09-30
|
||||
// async function update_ae_obj_id_crud_v2({
|
||||
// api_cfg,
|
||||
// object_type,
|
||||
// object_id,
|
||||
// object_reload = false,
|
||||
// field_name,
|
||||
// new_field_value,
|
||||
// params = {},
|
||||
// log_lvl = 0
|
||||
// }: {
|
||||
// api_cfg: any;
|
||||
// object_type: string;
|
||||
// object_id: string;
|
||||
// object_reload?: boolean;
|
||||
// field_name: string;
|
||||
// new_field_value: any;
|
||||
// params?: any | key_val;
|
||||
// log_lvl?: number;
|
||||
// }) {
|
||||
// if (log_lvl) {
|
||||
// console.log(
|
||||
// `*** update_ae_obj_id_crud_v2() *** object_type=${object_type}, object_id=${object_id}, object_reload=${object_reload}, field_name=${field_name}, new_field_value=`,
|
||||
// new_field_value
|
||||
// );
|
||||
// }
|
||||
|
||||
// const results = await api.update_ae_obj_id_crud({
|
||||
// api_cfg: api_cfg,
|
||||
// obj_type: object_type,
|
||||
// obj_id: object_id,
|
||||
// field_name: field_name,
|
||||
// field_value: new_field_value,
|
||||
// key: api_cfg.api_crud_super_key,
|
||||
// log_lvl: log_lvl
|
||||
// });
|
||||
|
||||
// if (results) {
|
||||
// if (log_lvl) {
|
||||
// console.log(`Patched - Field Name: ${field_name} with new Field Value: ${new_field_value}`);
|
||||
// }
|
||||
|
||||
// if (object_reload) {
|
||||
// if (log_lvl) {
|
||||
// console.log(`Reloading the object after patching...`);
|
||||
// }
|
||||
// // Trigger reloads based on object type. These are fire-and-forget or awaited internally by the library functions.
|
||||
// if (object_type == 'person') load_ae_obj_id__person({ api_cfg, person_id: object_id, log_lvl });
|
||||
// if (object_type == 'archive') load_ae_obj_id__archive({ api_cfg, archive_id: object_id, log_lvl });
|
||||
// if (object_type == 'archive_content') load_ae_obj_id__archive_content({ api_cfg, archive_content_id: object_id, log_lvl });
|
||||
// if (object_type == 'journal') load_ae_obj_id__journal({ api_cfg, journal_id: object_id, log_lvl });
|
||||
// if (object_type == 'journal_entry') load_ae_obj_id__journal_entry({ api_cfg, journal_entry_id: object_id, log_lvl });
|
||||
// if (object_type == 'event') load_ae_obj_id__event({ api_cfg, event_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_exhibit') load_ae_obj_id__event_exhibit({ api_cfg, exhibit_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_device') load_ae_obj_id__event_device({ api_cfg, event_device_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_file') load_ae_obj_id__event_file({ api_cfg, event_file_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_location') load_ae_obj_id__event_location({ api_cfg, event_location_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_presentation') load_ae_obj_id__event_presentation({ api_cfg, event_presentation_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_presenter') load_ae_obj_id__event_presenter({ api_cfg, event_presenter_id: object_id, log_lvl });
|
||||
// if (object_type == 'event_session') load_ae_obj_id__event_session({ api_cfg, event_session_id: object_id, log_lvl });
|
||||
// if (object_type == 'post') load_ae_obj_id__post({ api_cfg, post_id: object_id, log_lvl });
|
||||
// if (object_type == 'post_comment') load_ae_obj_id__post_comment({ api_cfg, post_comment_id: object_id, log_lvl });
|
||||
// }
|
||||
// } else {
|
||||
// if (log_lvl) {
|
||||
// console.log(`PATCH failed for ${object_type} ${object_id}`);
|
||||
// }
|
||||
// }
|
||||
|
||||
// return results;
|
||||
// }
|
||||
|
||||
|
||||
const export_obj = {
|
||||
check_hosted_file_obj_w_hash: check_hosted_file_obj_w_hash,
|
||||
@@ -284,7 +82,6 @@ const export_obj = {
|
||||
qry_ae_obj_li__user_email: qry_ae_obj_li__user_email,
|
||||
auth_ae_obj__user_id_change_password: auth_ae_obj__user_id_change_password,
|
||||
|
||||
// update_ae_obj_id_crud_v2: update_ae_obj_id_crud_v2,
|
||||
download_export__obj_type: download_export__obj_type,
|
||||
generate_qr_code: generate_qr_code,
|
||||
js_generate_qr_code: js_generate_qr_code
|
||||
|
||||
Reference in New Issue
Block a user