Saving changes to the Journals and API CRUD V3 fixes.
This commit is contained in:
@@ -1,6 +1,41 @@
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { get_object } from './api_get_object';
|
||||
|
||||
interface GetAeObjV3Params {
|
||||
api_cfg: any;
|
||||
obj_type: string;
|
||||
obj_id: string;
|
||||
view?: string;
|
||||
log_lvl?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a single object by ID (V3)
|
||||
*/
|
||||
export async function get_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type,
|
||||
obj_id,
|
||||
view = 'default',
|
||||
log_lvl = 0
|
||||
}: GetAeObjV3Params) {
|
||||
const endpoint = `/v3/crud/${obj_type}/${obj_id}`;
|
||||
const params: key_val = { view };
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('*** get_ae_obj_v3 ***');
|
||||
console.log('Endpoint:', endpoint);
|
||||
console.log('Params:', params);
|
||||
}
|
||||
|
||||
return await get_object({
|
||||
api_cfg,
|
||||
endpoint,
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
|
||||
interface GetAeObjLiV3Params {
|
||||
api_cfg: any;
|
||||
obj_type: string;
|
||||
@@ -8,6 +43,7 @@ interface GetAeObjLiV3Params {
|
||||
for_obj_id?: string;
|
||||
enabled?: 'all' | 'enabled' | 'not_enabled';
|
||||
hidden?: 'all' | 'hidden' | 'not_hidden';
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
@@ -22,19 +58,21 @@ export async function get_ae_obj_li_v3({
|
||||
for_obj_id,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
view = 'default',
|
||||
limit = 100,
|
||||
offset = 0,
|
||||
order_by_li = null,
|
||||
delay_ms = 0,
|
||||
log_lvl = 0
|
||||
}: GetAeObjLiV3Params) {
|
||||
// 1. Build V3 Endpoint (Note: No /list suffix)
|
||||
// 1. Build V3 Endpoint
|
||||
const endpoint = `/v3/crud/${obj_type}/`;
|
||||
|
||||
// 2. Build Query Params
|
||||
const params: key_val = {
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset
|
||||
};
|
||||
@@ -63,10 +101,11 @@ interface GetNestedObjLiV3Params {
|
||||
parent_type: string;
|
||||
parent_id: string;
|
||||
child_type: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
enabled?: 'all' | 'enabled' | 'not_enabled';
|
||||
hidden?: 'all' | 'hidden' | 'not_hidden';
|
||||
view?: string;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
delay_ms?: number;
|
||||
log_lvl?: number;
|
||||
@@ -77,10 +116,11 @@ export async function get_nested_obj_li_v3({
|
||||
parent_type,
|
||||
parent_id,
|
||||
child_type,
|
||||
limit = 100,
|
||||
offset = 0,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
view = 'default',
|
||||
limit = 100,
|
||||
offset = 0,
|
||||
order_by_li = null,
|
||||
delay_ms = 0,
|
||||
log_lvl = 0
|
||||
@@ -90,6 +130,7 @@ export async function get_nested_obj_li_v3({
|
||||
const params: key_val = {
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset
|
||||
};
|
||||
@@ -109,4 +150,4 @@ export async function get_nested_obj_li_v3({
|
||||
params,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,12 @@ import { post_object } from './api_post_object';
|
||||
interface SearchAeObjV3Params {
|
||||
api_cfg: any;
|
||||
obj_type: string;
|
||||
search_query: any; // Complex SearchQuery object
|
||||
search_query: any; // Complex SearchQuery object: { q: string, and: [], or: [] }
|
||||
enabled?: 'all' | 'enabled' | 'not_enabled';
|
||||
hidden?: 'all' | 'hidden' | 'not_hidden';
|
||||
view?: string;
|
||||
for_obj_type?: string;
|
||||
for_obj_id?: string;
|
||||
order_by_li?: Record<string, 'ASC' | 'DESC'> | null;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
@@ -16,6 +21,11 @@ export async function search_ae_obj_v3({
|
||||
api_cfg,
|
||||
obj_type,
|
||||
search_query,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
view = 'default',
|
||||
for_obj_type,
|
||||
for_obj_id,
|
||||
order_by_li = null,
|
||||
limit = 100,
|
||||
offset = 0,
|
||||
@@ -24,11 +34,17 @@ export async function search_ae_obj_v3({
|
||||
}: SearchAeObjV3Params) {
|
||||
const endpoint = `/v3/crud/${obj_type}/search`;
|
||||
|
||||
// Hybrid search: Standard filters passed as query params
|
||||
const params: key_val = {
|
||||
enabled,
|
||||
hidden,
|
||||
view,
|
||||
limit,
|
||||
offset
|
||||
};
|
||||
|
||||
if (for_obj_type) params['for_obj_type'] = for_obj_type;
|
||||
if (for_obj_id) params['for_obj_id'] = for_obj_id;
|
||||
if (order_by_li) params['order_by_li'] = JSON.stringify(order_by_li);
|
||||
if (delay_ms > 0) params['delay_ms'] = delay_ms;
|
||||
|
||||
@@ -47,4 +63,4 @@ export async function search_ae_obj_v3({
|
||||
data: search_query,
|
||||
log_lvl
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user