Remove _random field handling from event_session and event_file modules
Drop the _random key copy loop from _process_generic_props in both files —
V3 API returns {obj_type}_id directly as the random string ID, so copying
from {obj_type}_id_random is a no-op. Simplify .id assignment to use
baseIdKey only. Remove commented-out _random entries from properties_to_save.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -527,15 +527,11 @@ export const qry__event_file = search__event_file;
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
'event_file_id',
|
||||
// 'event_file_id_random', // DO NOT UNCOMMENT
|
||||
'hosted_file_id',
|
||||
// 'hosted_file_id_random', // DO NOT UNCOMMENT
|
||||
'hash_sha256',
|
||||
'for_type',
|
||||
'for_id',
|
||||
// 'for_id_random', // DO NOT UNCOMMENT
|
||||
'event_id',
|
||||
// 'event_id_random', // DO NOT UNCOMMENT
|
||||
'event_session_id',
|
||||
'event_presentation_id',
|
||||
'event_presenter_id',
|
||||
@@ -598,22 +594,9 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const processed_obj_li: T[] = [];
|
||||
for (const original_obj of obj_li) {
|
||||
let processed_obj = { ...original_obj };
|
||||
for (const key in processed_obj) {
|
||||
if (key.endsWith('_random')) {
|
||||
const newKey = key.slice(0, -7);
|
||||
// ONLY overwrite if the random variant has a valid value
|
||||
if (
|
||||
processed_obj[key] !== null &&
|
||||
processed_obj[key] !== undefined &&
|
||||
processed_obj[key] !== ''
|
||||
) {
|
||||
(processed_obj as any)[newKey] = processed_obj[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
const random_id_key = `${obj_type}_id_random`;
|
||||
if (processed_obj[random_id_key])
|
||||
(processed_obj as any).id = processed_obj[random_id_key];
|
||||
const base_id_key = `${obj_type}_id`;
|
||||
if (processed_obj[base_id_key])
|
||||
(processed_obj as any).id = processed_obj[base_id_key];
|
||||
const group = processed_obj.group ?? '0';
|
||||
const priority = processed_obj.priority ? 1 : 0;
|
||||
const sort = processed_obj.sort ?? '0';
|
||||
|
||||
@@ -836,12 +836,10 @@ export async function email_sign_in__event_session({
|
||||
export const properties_to_save = [
|
||||
'id',
|
||||
'event_session_id',
|
||||
// 'event_session_id_random',
|
||||
'external_id',
|
||||
'code',
|
||||
'for_type',
|
||||
'for_id',
|
||||
// 'for_id_random',
|
||||
'type_code',
|
||||
'event_id',
|
||||
'event_location_id',
|
||||
@@ -898,18 +896,8 @@ async function _process_generic_props<T extends Record<string, any>>({
|
||||
const processed_obj_li: T[] = [];
|
||||
for (const original_obj of obj_li) {
|
||||
let processed_obj = { ...original_obj };
|
||||
for (const key in processed_obj) {
|
||||
if (key.endsWith('_random')) {
|
||||
const newKey = key.slice(0, -7);
|
||||
(processed_obj as any)[newKey] = processed_obj[key];
|
||||
}
|
||||
}
|
||||
const randomIdKey = `${obj_type}_id_random`;
|
||||
const baseIdKey = `${obj_type}_id`;
|
||||
if (processed_obj[randomIdKey]) {
|
||||
(processed_obj as any).id = processed_obj[randomIdKey];
|
||||
(processed_obj as any)[baseIdKey] = processed_obj[randomIdKey];
|
||||
} else if (processed_obj[baseIdKey])
|
||||
if (processed_obj[baseIdKey])
|
||||
(processed_obj as any).id = processed_obj[baseIdKey];
|
||||
|
||||
const group = processed_obj.group ?? '0';
|
||||
|
||||
Reference in New Issue
Block a user