More code clean up
This commit is contained in:
@@ -374,7 +374,7 @@ export async function create_ae_obj__event({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Event | null> {
|
||||
const result = await api.create_ae_obj_v3({
|
||||
const result = await api.create_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'event',
|
||||
fields: {
|
||||
@@ -455,7 +455,7 @@ export async function update_ae_obj__event({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_Event | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
const result = await api.update_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'event',
|
||||
obj_id: event_id,
|
||||
|
||||
@@ -3,8 +3,8 @@ import { describe, it, expect, vi } from 'vitest';
|
||||
// Use hoist-safe factories for vi.mock
|
||||
vi.mock('$lib/api/api', () => ({
|
||||
api: {
|
||||
create_nested_obj_v3: vi.fn(),
|
||||
update_nested_obj_v3: vi.fn(),
|
||||
create_nested_obj: vi.fn(),
|
||||
update_nested_obj: vi.fn(),
|
||||
delete_nested_ae_obj: vi.fn(),
|
||||
search_ae_obj: vi.fn()
|
||||
}
|
||||
@@ -16,9 +16,9 @@ vi.mock('$lib/ae_events/ae_events__event_badge_template', () => ({ load_ae_obj_i
|
||||
import { create_ae_obj__event_badge } from './ae_events__event_badge';
|
||||
|
||||
describe('create_ae_obj__event_badge', () => {
|
||||
it('calls api.create_nested_obj_v3 with the correct params and returns the result', async () => {
|
||||
it('calls api.create_nested_obj with the correct params and returns the result', async () => {
|
||||
const mocked = await import('$lib/api/api');
|
||||
const mockCreateNested = mocked.api.create_nested_obj_v3 as any;
|
||||
const mockCreateNested = mocked.api.create_nested_obj as any;
|
||||
|
||||
const fakeResult = { event_badge_id: 'eb123', full_name: 'Test User' };
|
||||
mockCreateNested.mockResolvedValue(fakeResult);
|
||||
@@ -45,9 +45,9 @@ describe('create_ae_obj__event_badge', () => {
|
||||
});
|
||||
|
||||
describe('update_ae_obj__event_badge', () => {
|
||||
it('calls api.update_nested_obj_v3 with correct params and returns result', async () => {
|
||||
it('calls api.update_nested_obj with correct params and returns result', async () => {
|
||||
const mocked = await import('$lib/api/api');
|
||||
const mockUpdate = mocked.api.update_nested_obj_v3 as any;
|
||||
const mockUpdate = mocked.api.update_nested_obj as any;
|
||||
const fakeResult = { event_badge_id: 'eb999', full_name: 'Updated' };
|
||||
mockUpdate.mockResolvedValue(fakeResult);
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ export async function create_ae_obj__event_badge({
|
||||
console.log(`*** create_ae_obj__event_badge() *** event_id=${event_id}`);
|
||||
}
|
||||
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
@@ -318,7 +318,7 @@ export async function update_ae_obj__event_badge({
|
||||
console.log(`*** update_ae_obj__event_badge() *** event_badge_id=${event_badge_id}`);
|
||||
}
|
||||
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
|
||||
@@ -255,7 +255,7 @@ export async function create_ae_obj__event_badge_template({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
@@ -328,7 +328,7 @@ export async function update_ae_obj__event_badge_template({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}) {
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
|
||||
@@ -201,7 +201,7 @@ export async function create_ae_obj__event_device({
|
||||
console.log(`*** create_ae_obj__event_device() *** [V3] event_id=${event_id}`);
|
||||
}
|
||||
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
@@ -299,7 +299,7 @@ export async function update_ae_obj__event_device({
|
||||
console.log(`*** update_ae_obj__event_device() *** [V3] id=${event_device_id}`);
|
||||
}
|
||||
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
|
||||
@@ -344,7 +344,7 @@ export async function update_ae_obj__event_file({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventFile | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
const result = await api.update_ae_obj({
|
||||
api_cfg,
|
||||
obj_type: 'event_file',
|
||||
obj_id: event_file_id,
|
||||
|
||||
@@ -241,7 +241,7 @@ export async function create_ae_obj__event_location({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventLocation | null> {
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
@@ -312,7 +312,7 @@ export async function update_ae_obj__event_location({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventLocation | null> {
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
|
||||
@@ -218,7 +218,7 @@ export async function create_ae_obj__event_presentation({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresentation | null> {
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_session',
|
||||
for_obj_id: event_session_id,
|
||||
@@ -279,7 +279,7 @@ export async function update_ae_obj__event_presentation({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventPresentation | null> {
|
||||
const result = await api.update_ae_obj_v3({
|
||||
const result = await api.update_ae_obj({
|
||||
api_cfg, obj_type: 'event_presentation', obj_id: event_presentation_id, fields: data_kv, log_lvl
|
||||
});
|
||||
if (result) {
|
||||
|
||||
@@ -197,7 +197,7 @@ export async function create_ae_obj__event_presenter({
|
||||
console.error('create_ae_obj__event_presenter: event_presentation_id is required');
|
||||
return null;
|
||||
}
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
@@ -278,7 +278,7 @@ export async function update_ae_obj__event_presenter({
|
||||
console.error('update_ae_obj__event_presenter: event_presentation_id is required');
|
||||
return null;
|
||||
}
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event_presentation',
|
||||
for_obj_id: event_presentation_id,
|
||||
|
||||
@@ -282,7 +282,7 @@ export async function create_ae_obj__event_session({
|
||||
console.error('create_ae_obj__event_session: event_id is required');
|
||||
return null;
|
||||
}
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
@@ -360,7 +360,7 @@ export async function update_ae_obj__event_session({
|
||||
console.error('update_ae_obj__event_session: event_id is required');
|
||||
return null;
|
||||
}
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
for_obj_type: 'event',
|
||||
for_obj_id: event_id,
|
||||
|
||||
@@ -307,7 +307,7 @@ export async function create_ae_obj__exhibit({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibit | null> {
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
@@ -351,7 +351,7 @@ export async function update_ae_obj__exhibit({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibit | null> {
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event',
|
||||
parent_id: event_id,
|
||||
|
||||
@@ -324,7 +324,7 @@ export async function create_ae_obj__exhibit_tracking({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibitTracking | null> {
|
||||
const result = await api.create_nested_obj_v3({
|
||||
const result = await api.create_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event_exhibit',
|
||||
parent_id: exhibit_id,
|
||||
@@ -372,7 +372,7 @@ export async function update_ae_obj__exhibit_tracking({
|
||||
try_cache?: boolean;
|
||||
log_lvl?: number;
|
||||
}): Promise<ae_EventExhibitTracking | null> {
|
||||
const result = await api.update_nested_obj_v3({
|
||||
const result = await api.update_nested_obj({
|
||||
api_cfg,
|
||||
parent_type: 'event_exhibit',
|
||||
parent_id: exhibit_id,
|
||||
|
||||
Reference in New Issue
Block a user