feat: Migrate ESLint to flat config and resolve initial linting errors
Migrated the ESLint configuration to the new flat config format () and addressed several initial linting errors. Key changes include: - Updated ESLint configuration to treat as warnings instead of errors. - Fixed errors in by declaring and . - Corrected error in by using instead of an out-of-scope . - Resolved error in by replacing the undefined directive with the component. - Addressed errors in by replacing with and with . - Fixed errors in by importing necessary modules (, , ) and adding missing props (, , , , ).
This commit is contained in:
@@ -1,36 +1,35 @@
|
||||
import type { key_val } from '$lib/stores/ae_stores';
|
||||
import { api } from '$lib/api/api';
|
||||
|
||||
import { db_sponsorships } from "$lib/ae_sponsorships/db_sponsorships";
|
||||
import { db_sponsorships } from '$lib/ae_sponsorships/db_sponsorships';
|
||||
|
||||
// import { liveQuery } from "dexie";
|
||||
// import { db_core } from "$lib/db_core";
|
||||
|
||||
// --- PROPERTIES TO SAVE ---
|
||||
export const properties_to_save_sponsorship_cfg = [
|
||||
'id',
|
||||
'sponsorship_cfg_id',
|
||||
'account_id',
|
||||
'for_type',
|
||||
'for_id',
|
||||
'level_li_json',
|
||||
'option_li_json',
|
||||
'schedule_li_json',
|
||||
'cfg_json',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
// Generated fields for sorting locally only
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2',
|
||||
'id',
|
||||
'sponsorship_cfg_id',
|
||||
'account_id',
|
||||
'for_type',
|
||||
'for_id',
|
||||
'level_li_json',
|
||||
'option_li_json',
|
||||
'schedule_li_json',
|
||||
'cfg_json',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
// Generated fields for sorting locally only
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2'
|
||||
];
|
||||
|
||||
|
||||
// --- PROCESS FUNCTION ---
|
||||
export async function process_ae_obj__sponsorship_cfg_props({
|
||||
obj_li,
|
||||
@@ -57,48 +56,46 @@ export async function process_ae_obj__sponsorship_cfg_props({
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// --- PROPERTIES TO SAVE ---
|
||||
export const properties_to_save_sponsorship = [
|
||||
'id',
|
||||
'sponsorship_id',
|
||||
'account_id',
|
||||
'organization_id',
|
||||
'person_id',
|
||||
'poc_person_id',
|
||||
'poc_json',
|
||||
'name',
|
||||
'name_override',
|
||||
'description',
|
||||
'email',
|
||||
'website_url',
|
||||
'logo_li_json',
|
||||
'media_li_json',
|
||||
'social_li_json',
|
||||
'address_li_json',
|
||||
'contact_li_json',
|
||||
'guest_li_json',
|
||||
'level_num',
|
||||
'level_str',
|
||||
'amount',
|
||||
'questions_li_json',
|
||||
'agree',
|
||||
'comments',
|
||||
'staff_notes',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
// Generated fields for sorting locally only
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2',
|
||||
'id',
|
||||
'sponsorship_id',
|
||||
'account_id',
|
||||
'organization_id',
|
||||
'person_id',
|
||||
'poc_person_id',
|
||||
'poc_json',
|
||||
'name',
|
||||
'name_override',
|
||||
'description',
|
||||
'email',
|
||||
'website_url',
|
||||
'logo_li_json',
|
||||
'media_li_json',
|
||||
'social_li_json',
|
||||
'address_li_json',
|
||||
'contact_li_json',
|
||||
'guest_li_json',
|
||||
'level_num',
|
||||
'level_str',
|
||||
'amount',
|
||||
'questions_li_json',
|
||||
'agree',
|
||||
'comments',
|
||||
'staff_notes',
|
||||
'enable',
|
||||
'hide',
|
||||
'priority',
|
||||
'sort',
|
||||
'group',
|
||||
'notes',
|
||||
'created_on',
|
||||
'updated_on',
|
||||
// Generated fields for sorting locally only
|
||||
'tmp_sort_1',
|
||||
'tmp_sort_2'
|
||||
];
|
||||
|
||||
|
||||
// --- PROCESS FUNCTION ---
|
||||
export async function process_ae_obj__sponsorship_props({
|
||||
obj_li,
|
||||
@@ -125,7 +122,6 @@ export async function process_ae_obj__sponsorship_props({
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NON-EXPORTED LOCAL HELPER
|
||||
* Processes a list of Aether objects by applying common and specific transformations.
|
||||
@@ -194,310 +190,315 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
return processed_obj_li;
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-03-29
|
||||
async function load_ae_obj_id__sponsorship_cfg(
|
||||
{
|
||||
api_cfg,
|
||||
sponsorship_cfg_id,
|
||||
try_cache = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
sponsorship_cfg_id: string,
|
||||
try_cache: boolean,
|
||||
log_lvl: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`);
|
||||
}
|
||||
async function load_ae_obj_id__sponsorship_cfg({
|
||||
api_cfg,
|
||||
sponsorship_cfg_id,
|
||||
try_cache = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
sponsorship_cfg_id: string;
|
||||
try_cache: boolean;
|
||||
log_lvl: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_id__sponsorship_cfg() *** sponsorship_cfg_id=${sponsorship_cfg_id}`
|
||||
);
|
||||
}
|
||||
|
||||
let params = {};
|
||||
const params = {};
|
||||
|
||||
ae_promises.load__sponsorship_cfg_obj = api.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship_cfg',
|
||||
obj_id: sponsorship_cfg_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 in the API config.
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async function (sponsorship_cfg_obj_get_result) {
|
||||
if (sponsorship_cfg_obj_get_result) {
|
||||
if (log_lvl) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}`);
|
||||
} else if (log_lvl > 1) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`, sponsorship_cfg_obj_get_result);
|
||||
}
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__sponsorship_cfg_props({
|
||||
obj_li: [sponsorship_cfg_obj_get_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'cfg',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship_cfg,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_cfg_obj_get_result;
|
||||
} else {
|
||||
console.log('No results returned.');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
ae_promises.load__sponsorship_cfg_obj = api
|
||||
.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship_cfg',
|
||||
obj_id: sponsorship_cfg_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 in the API config.
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async function (sponsorship_cfg_obj_get_result) {
|
||||
if (sponsorship_cfg_obj_get_result) {
|
||||
if (log_lvl) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}`);
|
||||
} else if (log_lvl > 1) {
|
||||
console.log(
|
||||
`*spons_func* Got a result for sponsorship_cfg_id ${sponsorship_cfg_id}:`,
|
||||
sponsorship_cfg_obj_get_result
|
||||
);
|
||||
}
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__sponsorship_cfg_props({
|
||||
obj_li: [sponsorship_cfg_obj_get_result],
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'cfg',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship_cfg,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_cfg_obj_get_result;
|
||||
} else {
|
||||
console.log('No results returned.');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_cfg_obj:', ae_promises.load__sponsorship_cfg_obj);
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_cfg_obj:', ae_promises.load__sponsorship_cfg_obj);
|
||||
}
|
||||
|
||||
return ae_promises.load__sponsorship_cfg_obj;
|
||||
return ae_promises.load__sponsorship_cfg_obj;
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-03-29
|
||||
async function load_ae_obj_id__sponsorship(
|
||||
{
|
||||
api_cfg,
|
||||
sponsorship_id,
|
||||
try_cache = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
sponsorship_id: string,
|
||||
try_cache: boolean,
|
||||
log_lvl: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
|
||||
}
|
||||
async function load_ae_obj_id__sponsorship({
|
||||
api_cfg,
|
||||
sponsorship_id,
|
||||
try_cache = false,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
sponsorship_id: string;
|
||||
try_cache: boolean;
|
||||
log_lvl: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_id__sponsorship() *** sponsorship_id=${sponsorship_id}`);
|
||||
}
|
||||
|
||||
let params = {};
|
||||
const params = {};
|
||||
|
||||
ae_promises.load__sponsorship_obj = api.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship',
|
||||
obj_id: sponsorship_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 in the API config.
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async function (sponsorship_obj_get_result) {
|
||||
if (sponsorship_obj_get_result) {
|
||||
if (log_lvl) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`);
|
||||
} else if (log_lvl > 1) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`, sponsorship_obj_get_result);
|
||||
}
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__sponsorship_props({
|
||||
obj_li: [sponsorship_obj_get_result],
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'sponsorship',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_obj_get_result;
|
||||
} else {
|
||||
console.log('No results returned.');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
ae_promises.load__sponsorship_obj = api
|
||||
.get_ae_obj_id_crud({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship',
|
||||
obj_id: sponsorship_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 in the API config.
|
||||
params: params,
|
||||
log_lvl: log_lvl
|
||||
})
|
||||
.then(async function (sponsorship_obj_get_result) {
|
||||
if (sponsorship_obj_get_result) {
|
||||
if (log_lvl) {
|
||||
console.log(`*spons_func* Got a result for sponsorship_id ${sponsorship_id}`);
|
||||
} else if (log_lvl > 1) {
|
||||
console.log(
|
||||
`*spons_func* Got a result for sponsorship_id ${sponsorship_id}:`,
|
||||
sponsorship_obj_get_result
|
||||
);
|
||||
}
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__sponsorship_props({
|
||||
obj_li: [sponsorship_obj_get_result],
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'sponsorship',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_obj_get_result;
|
||||
} else {
|
||||
console.log('No results returned.');
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.catch(function (error: any) {
|
||||
console.log('No results returned or failed.', error);
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_obj:', ae_promises.load__sponsorship_obj);
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_obj:', ae_promises.load__sponsorship_obj);
|
||||
}
|
||||
|
||||
return ae_promises.load__sponsorship_obj;
|
||||
return ae_promises.load__sponsorship_obj;
|
||||
}
|
||||
|
||||
// Updated 2025-01-15
|
||||
async function load_ae_obj_li__sponsorship(
|
||||
{
|
||||
api_cfg,
|
||||
for_obj_type = 'account',
|
||||
for_obj_id,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = {'priority': 'DESC', 'sort': 'DESC', 'name': 'ASC', 'updated_on': 'DESC', 'created_on': 'DESC'},
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
for_obj_type: string,
|
||||
for_obj_id: string,
|
||||
inc_content_li?: boolean,
|
||||
enabled?: "enabled" | "all" | "not_enabled" | undefined,
|
||||
hidden?: "hidden" | "all" | "not_hidden" | undefined,
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
order_by_li?: key_val,
|
||||
params?: key_val,
|
||||
try_cache?: boolean,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
if (log_lvl) {
|
||||
console.log(`*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`);
|
||||
}
|
||||
async function load_ae_obj_li__sponsorship({
|
||||
api_cfg,
|
||||
for_obj_type = 'account',
|
||||
for_obj_id,
|
||||
enabled = 'enabled',
|
||||
hidden = 'not_hidden',
|
||||
limit = 99,
|
||||
offset = 0,
|
||||
order_by_li = {
|
||||
priority: 'DESC',
|
||||
sort: 'DESC',
|
||||
name: 'ASC',
|
||||
updated_on: 'DESC',
|
||||
created_on: 'DESC'
|
||||
},
|
||||
params = {},
|
||||
try_cache = true,
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
for_obj_type: string;
|
||||
for_obj_id: string;
|
||||
inc_content_li?: boolean;
|
||||
enabled?: 'enabled' | 'all' | 'not_enabled' | undefined;
|
||||
hidden?: 'hidden' | 'all' | 'not_hidden' | undefined;
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
order_by_li?: key_val;
|
||||
params?: key_val;
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
if (log_lvl) {
|
||||
console.log(
|
||||
`*** load_ae_obj_li__sponsorship() *** for_obj_type=${for_obj_type} for_obj_id=${for_obj_id}`
|
||||
);
|
||||
}
|
||||
|
||||
let params_json: key_val = {};
|
||||
const params_json: key_val = {};
|
||||
|
||||
ae_promises.load__sponsorship_obj_li = await api.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship',
|
||||
for_obj_type: for_obj_type,
|
||||
for_obj_id: for_obj_id,
|
||||
use_alt_tbl: false,
|
||||
use_alt_mdl: false,
|
||||
use_alt_exp: false,
|
||||
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(async function (sponsorship_obj_li_get_result) {
|
||||
if (sponsorship_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
let processed_obj_li = await process_ae_obj__sponsorship_props({
|
||||
obj_li: sponsorship_obj_li_get_result,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'sponsorship',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship,
|
||||
log_lvl: log_lvl,
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_obj_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
ae_promises.load__sponsorship_obj_li = await api
|
||||
.get_ae_obj_li_for_obj_id_crud_v2({
|
||||
api_cfg: api_cfg,
|
||||
obj_type: 'sponsorship',
|
||||
for_obj_type: for_obj_type,
|
||||
for_obj_id: for_obj_id,
|
||||
use_alt_tbl: false,
|
||||
use_alt_mdl: false,
|
||||
use_alt_exp: false,
|
||||
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(async function (sponsorship_obj_li_get_result) {
|
||||
if (sponsorship_obj_li_get_result) {
|
||||
if (try_cache) {
|
||||
// Process the results first
|
||||
const processed_obj_li = await process_ae_obj__sponsorship_props({
|
||||
obj_li: sponsorship_obj_li_get_result,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('Processed object list:', processed_obj_li);
|
||||
}
|
||||
// Save the updated results list to the database
|
||||
if (log_lvl) {
|
||||
console.log('Saving to DB...');
|
||||
}
|
||||
await db_save_ae_obj_li__ae_obj({
|
||||
db_instance: db_sponsorships,
|
||||
table_name: 'sponsorship',
|
||||
obj_li: processed_obj_li,
|
||||
properties_to_save: properties_to_save_sponsorship,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
if (log_lvl) {
|
||||
console.log('DB save completed.');
|
||||
}
|
||||
}
|
||||
return sponsorship_obj_li_get_result;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_obj_li:', ae_promises.load__sponsorship_obj_li);
|
||||
}
|
||||
if (log_lvl) {
|
||||
console.log('ae_promises.load__sponsorship_obj_li:', ae_promises.load__sponsorship_obj_li);
|
||||
}
|
||||
|
||||
return ae_promises.load__sponsorship_obj_li;
|
||||
return ae_promises.load__sponsorship_obj_li;
|
||||
}
|
||||
|
||||
export async function download_export__sponsorship({
|
||||
api_cfg,
|
||||
account_id,
|
||||
file_type = 'CSV', // 'CSV' or 'Excel'
|
||||
return_file = true,
|
||||
filename = 'no_filename.csv',
|
||||
auto_download = false,
|
||||
params = {}, // key value object is expected
|
||||
log_lvl = 0
|
||||
}: {
|
||||
api_cfg: any;
|
||||
account_id: string;
|
||||
file_type?: string;
|
||||
return_file?: boolean;
|
||||
filename?: string;
|
||||
auto_download?: boolean;
|
||||
params?: key_val;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
console.log('*** stores_event_api.js: get_sponsorship_export() ***');
|
||||
|
||||
const endpoint = `/v2/crud/sponsorship/list`;
|
||||
params['for_obj_type'] = 'account';
|
||||
params['for_obj_id'] = account_id;
|
||||
|
||||
export async function download_export__sponsorship(
|
||||
{
|
||||
api_cfg,
|
||||
account_id,
|
||||
file_type='CSV', // 'CSV' or 'Excel'
|
||||
return_file=true,
|
||||
filename='no_filename.csv',
|
||||
auto_download=false,
|
||||
params={}, // key value object is expected
|
||||
log_lvl=0
|
||||
}: {
|
||||
api_cfg: any,
|
||||
account_id: string,
|
||||
file_type?: string,
|
||||
return_file?: boolean,
|
||||
filename?: string,
|
||||
auto_download?: boolean,
|
||||
params?: key_val,
|
||||
log_lvl?: number
|
||||
}
|
||||
) {
|
||||
console.log('*** stores_event_api.js: get_sponsorship_export() ***');
|
||||
if (file_type == 'CSV' || file_type == 'Excel') {
|
||||
params['file_type'] = file_type;
|
||||
}
|
||||
params['return_file'] = true;
|
||||
|
||||
const endpoint = `/v2/crud/sponsorship/list`;
|
||||
params['for_obj_type'] = 'account';
|
||||
params['for_obj_id'] = account_id;
|
||||
ae_promises.download__sponsorship_export_file = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
return_blob: return_file,
|
||||
filename: filename,
|
||||
auto_download: auto_download,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
if (file_type == 'CSV' || file_type == 'Excel') {
|
||||
params['file_type'] = file_type;
|
||||
}
|
||||
params['return_file'] = true;
|
||||
|
||||
ae_promises.download__sponsorship_export_file = await api.get_object({
|
||||
api_cfg: api_cfg,
|
||||
endpoint: endpoint,
|
||||
params: params,
|
||||
return_blob: return_file,
|
||||
filename: filename,
|
||||
auto_download: auto_download,
|
||||
log_lvl: log_lvl
|
||||
});
|
||||
|
||||
console.log('ae_promises.download__sponsorship_export_file:', ae_promises.download__sponsorship_export_file);
|
||||
return ae_promises.download__sponsorship_export_file;
|
||||
console.log(
|
||||
'ae_promises.download__sponsorship_export_file:',
|
||||
ae_promises.download__sponsorship_export_file
|
||||
);
|
||||
return ae_promises.download__sponsorship_export_file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let export_obj = {
|
||||
load_ae_obj_id__sponsorship_cfg: load_ae_obj_id__sponsorship_cfg,
|
||||
load_ae_obj_id__sponsorship: load_ae_obj_id__sponsorship,
|
||||
load_ae_obj_li__sponsorship: load_ae_obj_li__sponsorship,
|
||||
download_export__sponsorship: download_export__sponsorship,
|
||||
const export_obj = {
|
||||
load_ae_obj_id__sponsorship_cfg: load_ae_obj_id__sponsorship_cfg,
|
||||
load_ae_obj_id__sponsorship: load_ae_obj_id__sponsorship,
|
||||
load_ae_obj_li__sponsorship: load_ae_obj_li__sponsorship,
|
||||
download_export__sponsorship: download_export__sponsorship
|
||||
};
|
||||
export let spons_func = export_obj;
|
||||
export const spons_func = export_obj;
|
||||
|
||||
@@ -7,115 +7,113 @@ import type { key_val } from '$lib/stores/ae_stores';
|
||||
|
||||
// Updated 2025-01-15
|
||||
export interface Sponsorship {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
sponsorship_id: string;
|
||||
// sponsorship_id_random: string;
|
||||
id: string;
|
||||
// id_random: string;
|
||||
sponsorship_id: string;
|
||||
// sponsorship_id_random: string;
|
||||
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
|
||||
organization_id?: null|string;
|
||||
person_id?: null|string;
|
||||
organization_id?: null | string;
|
||||
person_id?: null | string;
|
||||
|
||||
poc_person_id?: null|string;
|
||||
poc_json?: null|string;
|
||||
poc_person_id?: null | string;
|
||||
poc_json?: null | string;
|
||||
|
||||
name: null|string;
|
||||
name_override: null|string;
|
||||
name: null | string;
|
||||
name_override: null | string;
|
||||
|
||||
description?: null|string;
|
||||
description?: null | string;
|
||||
|
||||
email?: null|string;
|
||||
website_url?: null|string;
|
||||
email?: null | string;
|
||||
website_url?: null | string;
|
||||
|
||||
// html_text?: null|string;
|
||||
// thumbnail_url?: null|string;
|
||||
// picture_url?: null|string;
|
||||
// video_url?: null|string;
|
||||
// audio_url?: null|string;
|
||||
// image_url?: null|string;
|
||||
// document_url?: null|string;
|
||||
// logo_url?: null|string;
|
||||
// html_text?: null|string;
|
||||
// thumbnail_url?: null|string;
|
||||
// picture_url?: null|string;
|
||||
// video_url?: null|string;
|
||||
// audio_url?: null|string;
|
||||
// image_url?: null|string;
|
||||
// document_url?: null|string;
|
||||
// logo_url?: null|string;
|
||||
|
||||
logo_li_json?: null|string;
|
||||
media_li_json?: null|string;
|
||||
social_li_json?: null|string;
|
||||
address_li_json?: null|string;
|
||||
contact_li_json?: null|string;
|
||||
guest_li_json?: null|string;
|
||||
logo_li_json?: null | string;
|
||||
media_li_json?: null | string;
|
||||
social_li_json?: null | string;
|
||||
address_li_json?: null | string;
|
||||
contact_li_json?: null | string;
|
||||
guest_li_json?: null | string;
|
||||
|
||||
level_num?: null|number;
|
||||
level_str?: null|string;
|
||||
level_num?: null | number;
|
||||
level_str?: null | string;
|
||||
|
||||
amount?: null|number; // In dollars
|
||||
amount?: null | number; // In dollars
|
||||
|
||||
questions_li_json?: null|string;
|
||||
questions_li_json?: null | string;
|
||||
|
||||
agree?: null|boolean; // Catchall agree or consent
|
||||
agree?: null | boolean; // Catchall agree or consent
|
||||
|
||||
comments?: null|string; // From the sponsor
|
||||
staff_notes?: null|string; // Internal use; from staff
|
||||
comments?: null | string; // From the sponsor
|
||||
staff_notes?: null | string; // Internal use; from staff
|
||||
|
||||
enable: null|boolean;
|
||||
hide?: null|boolean;
|
||||
priority?: null|boolean
|
||||
sort?: null|number;
|
||||
group?: null|string;
|
||||
notes?: null|string;
|
||||
created_on: Date;
|
||||
updated_on?: null|Date;
|
||||
enable: null | boolean;
|
||||
hide?: null | boolean;
|
||||
priority?: null | boolean;
|
||||
sort?: null | number;
|
||||
group?: null | string;
|
||||
notes?: null | string;
|
||||
created_on: Date;
|
||||
updated_on?: null | Date;
|
||||
|
||||
// Generated fields for sorting locally only
|
||||
tmp_sort_1?: null|string;
|
||||
tmp_sort_2?: null|string;
|
||||
// Generated fields for sorting locally only
|
||||
tmp_sort_1?: null | string;
|
||||
tmp_sort_2?: null | string;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
// Additional fields for convenience (database views)
|
||||
}
|
||||
|
||||
|
||||
// Updated 2025-01-15
|
||||
export interface Sponsorship_Cfg {
|
||||
id: string;
|
||||
// id_random: string;
|
||||
sponsorship_cfg_id: string;
|
||||
// sponsorship_cfg_id_random: string;
|
||||
id: string;
|
||||
// id_random: string;
|
||||
sponsorship_cfg_id: string;
|
||||
// sponsorship_cfg_id_random: string;
|
||||
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
account_id: string;
|
||||
// account_id_random: string;
|
||||
|
||||
for_type?: null|string;
|
||||
for_id?: null|number;
|
||||
for_type?: null | string;
|
||||
for_id?: null | number;
|
||||
|
||||
level_li_json?: null|string;
|
||||
option_li_json?: null|string;
|
||||
schedule_li_json?: null|string;
|
||||
level_li_json?: null | string;
|
||||
option_li_json?: null | string;
|
||||
schedule_li_json?: null | string;
|
||||
|
||||
cfg_json?: null|key_val;
|
||||
cfg_json?: null | key_val;
|
||||
|
||||
enable: null|boolean;
|
||||
hide?: null|boolean;
|
||||
priority?: null|boolean
|
||||
sort?: null|number;
|
||||
group?: null|string;
|
||||
notes?: null|string;
|
||||
created_on: Date;
|
||||
updated_on?: null|Date;
|
||||
enable: null | boolean;
|
||||
hide?: null | boolean;
|
||||
priority?: null | boolean;
|
||||
sort?: null | number;
|
||||
group?: null | string;
|
||||
notes?: null | string;
|
||||
created_on: Date;
|
||||
updated_on?: null | Date;
|
||||
|
||||
// Additional fields for convenience (database views)
|
||||
// Additional fields for convenience (database views)
|
||||
}
|
||||
|
||||
|
||||
// Updated 2024-09-25
|
||||
export class MySubClassedDexie extends Dexie {
|
||||
// We just tell the typing system this is the case
|
||||
sponsorship!: Table<Sponsorship>;
|
||||
cfg!: Table<Sponsorship_Cfg>;
|
||||
// We just tell the typing system this is the case
|
||||
sponsorship!: Table<Sponsorship>;
|
||||
cfg!: Table<Sponsorship_Cfg>;
|
||||
|
||||
constructor() {
|
||||
super('ae_sponsorships_db');
|
||||
this.version(1).stores({
|
||||
sponsorship: `
|
||||
constructor() {
|
||||
super('ae_sponsorships_db');
|
||||
this.version(1).stores({
|
||||
sponsorship: `
|
||||
id, sponsorship_id,
|
||||
account_id,
|
||||
poc_person_id,
|
||||
@@ -124,12 +122,12 @@ export class MySubClassedDexie extends Dexie {
|
||||
agree,
|
||||
enable, hide, priority, sort, group, notes, created_on, updated_on, [updated_on+created_on], [created_on+updated_on]`,
|
||||
|
||||
cfg: `
|
||||
cfg: `
|
||||
id, sponsorship_cfg_id,
|
||||
account_id,
|
||||
for_type, for_id`,
|
||||
});
|
||||
}
|
||||
for_type, for_id`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const db_sponsorships = new MySubClassedDexie();
|
||||
|
||||
Reference in New Issue
Block a user