Improvements on how posts are pulled in and sorted.

This commit is contained in:
Scott Idem
2025-07-18 18:15:18 -04:00
parent fd69610a3a
commit 0ac7bea046
5 changed files with 82 additions and 32 deletions

View File

@@ -140,6 +140,7 @@ export async function load_ae_obj_li__post(
api_cfg,
for_obj_type = 'account',
for_obj_id,
qry_archive_on = null,
inc_comment_li = false,
enabled = 'enabled',
hidden = 'not_hidden',
@@ -147,18 +148,21 @@ export async function load_ae_obj_li__post(
offset = 0,
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'updated_on': 'DESC', 'created_on': 'DESC', 'title': 'ASC'},
params = {},
params_json = null,
try_cache = true,
log_lvl = 0
}: {
api_cfg: any,
for_obj_type: string,
for_obj_id: string,
qry_archive_on?: boolean|null|string,
inc_comment_li?: boolean,
enabled?: string,
hidden?: string,
limit?: number,
offset?: number,
order_by_li?: key_val,
params_json?: null|key_val,
params?: key_val,
try_cache?: boolean,
log_lvl?: number
@@ -168,12 +172,48 @@ export async function load_ae_obj_li__post(
console.log(`*** load_ae_obj_li__post() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
}
let params_json: key_val = {};
// There is probably a better way to handle this. I don't want to just start a new object if it is not passed. However, the qry_conference and qry_str are sort of a special case. -2024-10-01
if (!params_json) {
params_json = {};
}
params_json['qry'] = [];
if (qry_archive_on) {
// let qry_param =
// {
// type: "AND",
// field: "archive_on",
// operator: ">",
// value: qry_archive_on
// };
// params_json['qry'].push(qry_param);
}
// if (qry_archive_on) {
// if (!params_json['and_qry']) {
// params_json['and_qry'] = {};
// }
// params_json['and_qry']['archive_on'] = qry_archive_on;
// } else if (qry_archive_on === false) {
// if (!params_json['and_qry']) {
// params_json['and_qry'] = {};
// }
// if (log_lvl) {
// console.log('qry_archive_on is false!');
// }
// params_json['and_qry']['conference'] = qry_archive_on;
// }
if (log_lvl) {
console.log('params_json:', params_json);
}
ae_promises.load__post_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'post',

View File

@@ -36,7 +36,7 @@ export interface Post {
enable_comments?: null|boolean;
archive?: null|boolean;
archive_on?: Date;
archive_on?: null|Date;
linked_li_json?: null|string;
cfg_json?: null|key_val;