More work to prepare the new Archives, Posts, and Recovery Meetings

This commit is contained in:
Scott Idem
2024-09-25 18:44:49 -04:00
parent 283850e917
commit 32ca117b11
15 changed files with 1272 additions and 164 deletions

View File

@@ -69,7 +69,6 @@ export async function load_ae_obj_id__post(
api_cfg: api_cfg,
for_obj_type: 'post',
for_obj_id: post_id,
inc_comment_li: inc_comment_li,
params: {qry__enabled: 'all', qry__limit: 25},
try_cache: try_cache,
log_lvl: log_lvl
@@ -196,6 +195,61 @@ export async function load_ae_obj_li__post(
}
// Updated 2024-09-25
export async function create_ae_obj__post(
{
api_cfg,
account_id,
data_kv,
params={},
log_lvl=0
}: {
api_cfg: any,
account_id: string,
data_kv: key_val,
params?: key_val,
log_lvl?: number
}
) {
console.log(`*** create_ae_obj__post() *** account_id=${account_id}`);
ae_promises.create__post = await api.create_ae_obj_crud({
api_cfg: api_cfg,
obj_type: 'post',
fields: {
account_id_random: account_id,
...data_kv
},
key: api_cfg.api_crud_super_key,
params: params,
return_obj: true,
log_lvl: log_lvl
})
.then(function (post_obj_create_result) {
if (post_obj_create_result) {
db_save_ae_obj_li__post(
{
obj_type: 'post',
obj_li: [post_obj_create_result]
});
return post_obj_create_result;
} else {
return null;
}
})
.catch(function (error) {
console.log('No results returned or failed.', error);
})
.finally(function () {
});
if (log_lvl) {
console.log('ae_promises.create__post:', ae_promises.create__post);
}
return ae_promises.create__post;
}
// Updated 2024-09-25
export async function update_ae_obj__post(
{
@@ -220,7 +274,7 @@ export async function update_ae_obj__post(
ae_promises.update__post_obj = await api.update_ae_obj_id_crud({
api_cfg: api_cfg,
obj_type: 'post',
obj_id: post_id, // NOTE: This is the FQDN, not normally the ID.
obj_id: post_id,
fields: data_kv,
key: api_cfg.api_crud_super_key,
params: params,
@@ -257,7 +311,7 @@ export async function update_ae_obj__post(
export async function qry__post(
{
api_cfg,
post_id,
account_id,
qry_str,
qry_files,
qry_start_datetime, // Example greater than: '2024-10-24'
@@ -270,7 +324,7 @@ export async function qry__post(
log_lvl = 0
}: {
api_cfg: any,
post_id: any,
account_id: any,
qry_str?: string,
qry_files?: null|boolean,
qry_start_datetime?: null|string, // Greater than this datetime
@@ -283,7 +337,7 @@ export async function qry__post(
log_lvl?: number
}
) {
console.log(`*** qry__post() *** post_id=${post_id} qry_str=${qry_str}`);
console.log(`*** qry__post() *** account_id=${account_id} qry_str=${qry_str}`);
// let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
// let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
@@ -335,8 +389,8 @@ export async function qry__post(
ae_promises.load__post_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
api_cfg: api_cfg,
obj_type: 'post',
for_obj_type: 'event',
for_obj_id: post_id,
for_obj_type: 'account',
for_obj_id: account_id,
use_alt_tbl: true, // NOTE: We want to use the alt table for post searching
use_alt_mdl: false,
use_alt_exp: false,
@@ -533,22 +587,19 @@ export function db_save_ae_obj_li__post(
id: obj.post_id_random,
post_id: obj.post_id_random,
code: obj.code,
account_id: obj.account_id_random,
name: obj.name,
description: obj.description,
title: null|string;
content?: null|string;
original_datetime: obj.original_datetime,
original_timezone: obj.original_timezone,
original_location: obj.original_location,
anonymous: obj.anonymous,
full_name: obj.full_name,
email: obj.email,
original_url: obj.original_url,
original_url_text: obj.original_url_text,
enable_comments: obj.enable_comments,
sort_by: obj.sort_by,
sort_by_desc: obj.sort_by_desc,
archive: obj.archive,
archive_on: obj.archive_on,
cfg_json: obj.cfg_json,