Now done for the night.
This commit is contained in:
@@ -28,7 +28,7 @@ export async function get_ae_obj_li_for_obj_id_crud(
|
||||
}: {
|
||||
api_cfg: any,
|
||||
obj_type: string,
|
||||
for_obj_type: string,
|
||||
for_obj_type: null|string,
|
||||
for_obj_id?: string,
|
||||
use_alt_table?: boolean,
|
||||
use_alt_base?: boolean,
|
||||
@@ -126,15 +126,15 @@ export async function get_ae_obj_li_for_obj_id_crud(
|
||||
endpoint = `/crud/sponsorship/list`;
|
||||
// } else if (obj_type == 'user') {
|
||||
// endpoint = `/crud/user/list`;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
|
||||
// endpoint = `/crud/lu/country_subdivision/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'country') {
|
||||
// endpoint = `/crud/lu/country/list`;
|
||||
// for_obj_type = null;
|
||||
// } else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
|
||||
// endpoint = `/crud/lu/time_zone/list`;
|
||||
// for_obj_type = null;
|
||||
} else if (obj_type == 'lu' && for_obj_type == 'country_subdivision') {
|
||||
endpoint = `/crud/lu/country_subdivision/list`;
|
||||
for_obj_type = null;
|
||||
} else if (obj_type == 'lu' && for_obj_type == 'country') {
|
||||
endpoint = `/crud/lu/country/list`;
|
||||
for_obj_type = null;
|
||||
} else if (obj_type == 'lu' && for_obj_type == 'time_zone') {
|
||||
endpoint = `/crud/lu/time_zone/list`;
|
||||
for_obj_type = null;
|
||||
} else {
|
||||
console.log(`Unknown object type: ${obj_type}`);
|
||||
return false;
|
||||
|
||||
37
src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts
Normal file
37
src/lib/ae_core/core__check_hosted_file_obj_w_hash.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
|
||||
// Updated 2024-10-02
|
||||
export async function check_hosted_file_obj_w_hash(
|
||||
{
|
||||
api_cfg,
|
||||
hosted_file_hash,
|
||||
check_for_local = true, // Forces a check on the host server for the file.
|
||||
params = {},
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
hosted_file_hash: string,
|
||||
check_for_local?: boolean,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log('*** stores_event_api.js: check_hosted_file_obj_w_hash() ***');
|
||||
|
||||
const endpoint = `/hosted_file/hash/${hosted_file_hash}`;
|
||||
if (check_for_local) {
|
||||
params['check_for_local'] = true;
|
||||
}
|
||||
let check_hosted_file_obj_w_hash_get_promise = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
return_meta: return_meta,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
return check_hosted_file_obj_w_hash_get_promise;
|
||||
}
|
||||
67
src/lib/ae_core/core__countries.ts
Normal file
67
src/lib/ae_core/core__countries.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_core } from "$lib/db_core";
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-10-14
|
||||
export async function load_ae_obj_li__country(
|
||||
{
|
||||
api_cfg,
|
||||
// account_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
// account_id: string,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__country() ***`);
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
|
||||
ae_promises.load__country_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'lu',
|
||||
for_obj_type: 'country',
|
||||
// for_obj_id: account_id,
|
||||
use_alt_table: false, // 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: {'english_short_name': 'ASC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (country_li_get_result) {
|
||||
if (country_li_get_result) {
|
||||
// handle_db_save_ae_obj_li__country({obj_type: 'country', obj_li: country_li_get_result});
|
||||
return country_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
console.log('ae_promises.load__country_li:', ae_promises.load__country_li);
|
||||
return ae_promises.load__country_li;
|
||||
}
|
||||
67
src/lib/ae_core/core__country_subdivisions.ts
Normal file
67
src/lib/ae_core/core__country_subdivisions.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_core } from "$lib/db_core";
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-10-14
|
||||
export async function load_ae_obj_li__country_subdivision(
|
||||
{
|
||||
api_cfg,
|
||||
// account_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
// account_id: string,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__country_subdivision() ***`);
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 300); // Actual is 249 in 2024
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
|
||||
ae_promises.load__country_subdivision_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'lu',
|
||||
for_obj_type: 'country_subdivision',
|
||||
// for_obj_id: account_id,
|
||||
use_alt_table: false, // 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: {'name': 'ASC', 'code': 'ASC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (country_subdivision_li_get_result) {
|
||||
if (country_subdivision_li_get_result) {
|
||||
// handle_db_save_ae_obj_li__country_subdivision({obj_type: 'country_subdivision', obj_li: country_subdivision_li_get_result});
|
||||
return country_subdivision_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
console.log('ae_promises.load__country_subdivision_li:', ae_promises.load__country_subdivision_li);
|
||||
return ae_promises.load__country_subdivision_li;
|
||||
}
|
||||
67
src/lib/ae_core/core__time_zones.ts
Normal file
67
src/lib/ae_core/core__time_zones.ts
Normal file
@@ -0,0 +1,67 @@
|
||||
import type { key_val } from '$lib/ae_stores';
|
||||
import { api } from '$lib/api';
|
||||
|
||||
import { db_core } from "$lib/db_core";
|
||||
|
||||
let ae_promises: key_val = {};
|
||||
|
||||
|
||||
// Updated 2024-10-14
|
||||
export async function load_ae_obj_li__time_zone(
|
||||
{
|
||||
api_cfg,
|
||||
// account_id,
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
// account_id: string,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log(`*** load_ae_obj_li__time_zone() ***`);
|
||||
|
||||
let enabled: string = (params.qry__enabled ?? 'enabled'); // all, disabled, enabled
|
||||
let hidden: string = (params.qry__hidden ?? 'not_hidden'); // all, hidden, not_hidden
|
||||
let limit: number = (params.qry__limit ?? 625); // Actual is 594 in 2024
|
||||
let offset: number = (params.qry__offset ?? 0); // 0
|
||||
|
||||
|
||||
let params_json: key_val = {};
|
||||
|
||||
// console.log('params_json:', params_json);
|
||||
|
||||
ae_promises.load__time_zone_li = await api.get_ae_obj_li_for_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'lu',
|
||||
for_obj_type: 'time_zone',
|
||||
// for_obj_id: account_id,
|
||||
use_alt_table: false, // 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: {'name': 'ASC'},
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
params_json: params_json,
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(function (time_zone_li_get_result) {
|
||||
if (time_zone_li_get_result) {
|
||||
// handle_db_save_ae_obj_li__time_zone({obj_type: 'time_zone', obj_li: time_zone_li_get_result});
|
||||
return time_zone_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
console.log('ae_promises.load__time_zone_li:', ae_promises.load__time_zone_li);
|
||||
return ae_promises.load__time_zone_li;
|
||||
}
|
||||
@@ -9,51 +9,31 @@ import {
|
||||
handle_create_ae_obj__person,
|
||||
handle_update_ae_obj__person,
|
||||
// handle_db_save_ae_obj_li__person
|
||||
} from "$lib/ae_core__person";
|
||||
} from "$lib/ae_core/core__person";
|
||||
|
||||
import {
|
||||
generate_qr_code,
|
||||
} from "$lib/ae_core__qr_code";
|
||||
} from "$lib/ae_core/core__qr_code";
|
||||
|
||||
import {
|
||||
check_hosted_file_obj_w_hash
|
||||
} from "$lib/ae_core/core__check_hosted_file_obj_w_hash";
|
||||
|
||||
import {
|
||||
load_ae_obj_li__time_zone
|
||||
} from "$lib/ae_core/core__time_zones";
|
||||
|
||||
import {
|
||||
load_ae_obj_li__country
|
||||
} from "$lib/ae_core/core__countries";
|
||||
|
||||
import {
|
||||
load_ae_obj_li__country_subdivision
|
||||
} from "$lib/ae_core/core__country_subdivisions";
|
||||
|
||||
let ae_promises: key_val = {}; // Promise<any>;
|
||||
|
||||
|
||||
// Updated 2024-10-02
|
||||
async function check_hosted_file_obj_w_hash(
|
||||
{
|
||||
api_cfg,
|
||||
hosted_file_hash,
|
||||
check_for_local = true, // Forces a check on the host server for the file.
|
||||
params = {},
|
||||
return_meta = false,
|
||||
log_lvl = 0
|
||||
} : {
|
||||
api_cfg: any,
|
||||
hosted_file_hash: string,
|
||||
check_for_local?: boolean,
|
||||
params?: key_val,
|
||||
return_meta?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log('*** stores_event_api.js: check_hosted_file_obj_w_hash() ***');
|
||||
|
||||
const endpoint = `/hosted_file/hash/${hosted_file_hash}`;
|
||||
if (check_for_local) {
|
||||
params['check_for_local'] = true;
|
||||
}
|
||||
let check_hosted_file_obj_w_hash_get_promise = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
return_meta: return_meta,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
return check_hosted_file_obj_w_hash_get_promise;
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-03-29
|
||||
async function handle_load_ae_obj_id__site_domain(
|
||||
{
|
||||
@@ -407,6 +387,9 @@ async function handle_download_export__obj_type(
|
||||
|
||||
let export_obj = {
|
||||
check_hosted_file_obj_w_hash: check_hosted_file_obj_w_hash,
|
||||
load_ae_obj_li__time_zone: load_ae_obj_li__time_zone,
|
||||
load_ae_obj_li__country: load_ae_obj_li__country,
|
||||
load_ae_obj_li__country_subdivision: load_ae_obj_li__country_subdivision,
|
||||
handle_load_ae_obj_id__site_domain: handle_load_ae_obj_id__site_domain,
|
||||
handle_load_ae_obj_code__data_store: handle_load_ae_obj_code__data_store,
|
||||
handle_load_ae_obj_id__person: handle_load_ae_obj_id__person,
|
||||
|
||||
@@ -4,6 +4,7 @@ import { fade } from 'svelte/transition';
|
||||
// import Editor from '@tinymce/tinymce-svelte';
|
||||
|
||||
import { ae_util } from '$lib/ae_utils/ae_utils';
|
||||
import { core_func } from '$lib/ae_core_functions';
|
||||
import { api } from '$lib/api';
|
||||
import { ae_snip, ae_loc, ae_sess, ae_api, ae_trig, slct, slct_trigger } from '$lib/ae_stores';
|
||||
import { idaa_loc, idaa_sess, idaa_slct } from '$lib/ae_idaa_stores';
|
||||
@@ -94,21 +95,16 @@ if ($idaa_slct.event_id) {
|
||||
console.log(`Event Object started: ${$idaa_slct.event_obj}`);
|
||||
}
|
||||
|
||||
// $ae_loc.lu_time_zone_list = [];
|
||||
if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
|
||||
// console.log('Already have time zone list!', $ae_loc.lu_time_zone_list);
|
||||
} else {
|
||||
console.log('No time zone list');
|
||||
|
||||
let lu_time_zone_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
let lu_time_zone_li_get_promise = core_func.load_ae_obj_li__time_zone({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'lu', // "lu" = a lookup table
|
||||
for_obj_type: 'time_zone',
|
||||
enabled: null,
|
||||
hidden: null,
|
||||
// order_by_li: {'name': 'ASC'},
|
||||
log_lvl: 1
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (lu_time_zone_li_get_result) {
|
||||
if (lu_time_zone_li_get_result) {
|
||||
$ae_loc.lu_time_zone_list = lu_time_zone_li_get_result;
|
||||
@@ -123,23 +119,43 @@ if ($ae_loc.lu_time_zone_list && $ae_loc.lu_time_zone_list.length > 0) {
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
// let lu_time_zone_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'lu', // "lu" = a lookup table
|
||||
// for_obj_type: 'time_zone',
|
||||
// enabled: null,
|
||||
// hidden: null,
|
||||
// // order_by_li: {'name': 'ASC'},
|
||||
// log_lvl: 1
|
||||
// })
|
||||
|
||||
// .then(function (lu_time_zone_li_get_result) {
|
||||
// if (lu_time_zone_li_get_result) {
|
||||
// $ae_loc.lu_time_zone_list = lu_time_zone_li_get_result;
|
||||
// console.log(`Time zone list:`, $ae_loc.lu_time_zone_list);
|
||||
// console.log($ae_loc.lu_time_zone_list[0]);
|
||||
// console.log($ae_loc.lu_time_zone_list[10]);
|
||||
// } else {
|
||||
// console.log(`No time zones returned!`);
|
||||
// $ae_loc.lu_time_zone_list = [];
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
}
|
||||
|
||||
if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 0) {
|
||||
// $ae_loc.lu_country_list = [];
|
||||
if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 150) {
|
||||
// console.log('Already have country list!', $ae_loc.lu_country_list);
|
||||
} else {
|
||||
console.log('No country list');
|
||||
|
||||
let lu_country_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
let lu_country_li_get_promise = core_func.load_ae_obj_li__country({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'lu', // "lu" = a lookup table
|
||||
for_obj_type: 'country',
|
||||
enabled: null,
|
||||
hidden: null,
|
||||
// order_by_li: {'sort': 'DESC', 'english_short_name': 'ASC'},
|
||||
log_lvl: 1
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (lu_country_li_get_result) {
|
||||
if (lu_country_li_get_result) {
|
||||
$ae_loc.lu_country_list = lu_country_li_get_result;
|
||||
@@ -154,23 +170,43 @@ if ($ae_loc.lu_country_list && $ae_loc.lu_country_list.length > 0) {
|
||||
.catch(function (error) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
// let lu_country_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
// api_cfg: $ae_api,
|
||||
// obj_type: 'lu', // "lu" = a lookup table
|
||||
// for_obj_type: 'country',
|
||||
// enabled: null,
|
||||
// hidden: null,
|
||||
// // order_by_li: {'sort': 'DESC', 'english_short_name': 'ASC'},
|
||||
// log_lvl: 1
|
||||
// })
|
||||
|
||||
// .then(function (lu_country_li_get_result) {
|
||||
// if (lu_country_li_get_result) {
|
||||
// $ae_loc.lu_country_list = lu_country_li_get_result;
|
||||
// console.log(`Country list:`, $ae_loc.lu_country_list);
|
||||
// console.log($ae_loc.lu_country_list[0]);
|
||||
// console.log($ae_loc.lu_country_list[10]);
|
||||
// } else {
|
||||
// console.log(`No countries returned!`);
|
||||
// $ae_loc.lu_country_list = [];
|
||||
// }
|
||||
// })
|
||||
// .catch(function (error) {
|
||||
// console.log('No results returned or failed.', error);
|
||||
// });
|
||||
}
|
||||
|
||||
$ae_loc.lu_country_subdivision_list = [];
|
||||
if ($ae_loc.lu_country_subdivision_list && $ae_loc.lu_country_subdivision_list.length > 0) {
|
||||
// console.log('Already have country subdivision list!', $ae_loc.lu_country_subdivision_list);
|
||||
} else {
|
||||
console.log('No country subdivision list');
|
||||
|
||||
let lu_country_subdivision_li_get_promise = api.get_ae_obj_li_for_obj_id_crud({
|
||||
let lu_country_subdivision_li_get_promise = core_func.load_ae_obj_li__country_subdivision({
|
||||
api_cfg: $ae_api,
|
||||
obj_type: 'lu', // "lu" = a lookup table
|
||||
for_obj_type: 'country_subdivision',
|
||||
enabled: null,
|
||||
hidden: null,
|
||||
// order_by_li: {'sort': 'DESC', 'english_short_name': 'ASC'},
|
||||
log_lvl: 1
|
||||
log_lvl: 2
|
||||
})
|
||||
|
||||
.then(function (lu_country_subdivision_li_get_result) {
|
||||
if (lu_country_subdivision_li_get_result) {
|
||||
$ae_loc.lu_country_subdivision_list = lu_country_subdivision_li_get_result;
|
||||
|
||||
Reference in New Issue
Block a user