Finally really starting to move things to v2 of the CRUD API.

This commit is contained in:
Scott Idem
2024-11-20 15:11:57 -05:00
parent fd602a46ac
commit 6b60c14159
9 changed files with 180 additions and 139 deletions

View File

@@ -24,7 +24,9 @@ export async function load_ae_obj_id__archive(
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`);
if (log_lvl) {
console.log(`*** load_ae_obj_id__archive() *** archive_id=${archive_id}`);
}
let params = {};
@@ -90,7 +92,7 @@ export async function load_ae_obj_id__archive(
}
// Updated 2024-09-25
// Updated 2024-11-20
export async function load_ae_obj_li__archive(
{
api_cfg,
@@ -112,7 +114,9 @@ export async function load_ae_obj_li__archive(
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
if (log_lvl) {
console.log(`*** load_ae_obj_li__archive() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
}
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
@@ -123,13 +127,47 @@ export async function load_ae_obj_li__archive(
// console.log('params_json:', params_json);
ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
// ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
// api_cfg: api_cfg,
// obj_type: 'archive',
// for_obj_type: for_obj_type,
// for_obj_id: for_obj_id,
// use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
// use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
// enabled: enabled,
// hidden: hidden,
// order_by_li: order_by_li,
// limit: limit,
// offset: offset,
// params_json: params_json,
// params: params,
// log_lvl: log_lvl
// })
// .then(function (archive_obj_li_get_result) {
// if (archive_obj_li_get_result) {
// if (try_cache) {
// db_save_ae_obj_li__archive({
// obj_type: 'archive',
// obj_li: archive_obj_li_get_result
// });
// }
// return archive_obj_li_get_result;
// } else {
// return [];
// }
// })
// .catch(function (error) {
// console.log('No results returned or failed.', error);
// });
ae_promises.load__archive_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'archive',
for_obj_type: for_obj_type,
for_obj_id: for_obj_id,
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
use_alt_tbl: false,
use_alt_mdl: false,
use_alt_exp: false,
enabled: enabled,
hidden: hidden,
order_by_li: order_by_li,
@@ -151,9 +189,6 @@ export async function load_ae_obj_li__archive(
} else {
return [];
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
});
if (log_lvl) {
@@ -460,10 +495,12 @@ export async function qry__archive(
})
.then(function (archive_obj_li_get_result) {
if (archive_obj_li_get_result) {
db_save_ae_obj_li__archive({
obj_type: 'archive',
obj_li: archive_obj_li_get_result
});
if (try_cache) {
db_save_ae_obj_li__archive({
obj_type: 'archive',
obj_li: archive_obj_li_get_result
});
}
return archive_obj_li_get_result;
} else {
return [];

View File

@@ -23,7 +23,9 @@ export async function load_ae_obj_id__archive_content(
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`);
if (log_lvl) {
console.log(`*** load_ae_obj_id__archive_content() *** archive_content_id=${archive_content_id}`);
}
let params = {};
@@ -60,7 +62,7 @@ export async function load_ae_obj_id__archive_content(
}
// Updated 2024-09-25
// Updated 2024-11-20
export async function load_ae_obj_li__archive_content(
{
api_cfg,
@@ -88,7 +90,9 @@ export async function load_ae_obj_li__archive_content(
log_lvl?: number
}
) {
console.log(`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
if (log_lvl) {
console.log(`*** load_ae_obj_li__archive_content() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
}
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
// let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
@@ -99,13 +103,14 @@ export async function load_ae_obj_li__archive_content(
// console('params_json:', params_json);
ae_promises.load__archive_content_obj_li = await api.get_ae_obj_li_for_obj_id_crud({
ae_promises.load__archive_content_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'archive_content',
for_obj_type: for_obj_type,
for_obj_id: for_obj_id,
use_alt_table: true, // NOTE: This will use the table_name_alt value instead of the table_name value in the API config.
use_alt_base: false, // NOTE: This will use the base_name_alt value instead of the base_name value
use_alt_tbl: false,
use_alt_mdl: false,
use_alt_exp: false,
enabled: enabled,
hidden: hidden,
order_by_li: order_by_li,