Migrate initial site domain lookup to Aether API CRUD V3
- Implemented lookup_site_domain_v3 in ae_core__site.ts using Search API - Refactored root +layout.ts to use the new V3 lookup logic - Standardized top-level data initialization with V3 response metadata - Improved security by transitioning to standardized V3 API patterns
This commit is contained in:
@@ -77,6 +77,46 @@ export interface Site_Domain {
|
||||
*/
|
||||
|
||||
// Updated 2026-01-06
|
||||
// Updated 2026-01-06
|
||||
export async function lookup_site_domain_v3({
|
||||
api_cfg,
|
||||
fqdn,
|
||||
view = 'default',
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
fqdn: string;
|
||||
view?: string;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** lookup_site_domain_v3() *** fqdn=${fqdn}`);
|
||||
}
|
||||
|
||||
const search_query = {
|
||||
and: [{ field: 'fqdn', op: 'eq', value: fqdn }]
|
||||
};
|
||||
|
||||
// We use search because we are looking up by a unique field (fqdn) rather than ID.
|
||||
// The backend should return a list, but since FQDN is unique, it will have 1 item.
|
||||
const result_li = await api.search_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type: 'site_domain',
|
||||
search_query,
|
||||
view, // This view should ideally join with site and account for the root lookup
|
||||
enabled: 'enabled',
|
||||
hidden: 'all',
|
||||
limit: 1,
|
||||
log_lvl
|
||||
});
|
||||
|
||||
if (result_li && result_li.length > 0) {
|
||||
return result_li[0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function load_ae_obj_id__site({
|
||||
api_cfg,
|
||||
site_id,
|
||||
|
||||
Reference in New Issue
Block a user