diff --git a/apps/client/src/common/hooks/useEventAction.ts b/apps/client/src/common/hooks/useEventAction.ts index bd3e059a6..9ec11f7da 100644 --- a/apps/client/src/common/hooks/useEventAction.ts +++ b/apps/client/src/common/hooks/useEventAction.ts @@ -155,7 +155,7 @@ export const useEventAction = () => { const updateCustomField = useCallback( async (eventId: string, field: string, value: string) => { - updateEvent({ id: eventId, custom: { [field]: { value } } }); + updateEvent({ id: eventId, custom: { [field]: value } }); }, [updateEvent], ); diff --git a/apps/client/src/common/utils/__tests__/eventsManager.test.ts b/apps/client/src/common/utils/__tests__/eventsManager.test.ts index 005d92618..3fcc5ef40 100644 --- a/apps/client/src/common/utils/__tests__/eventsManager.test.ts +++ b/apps/client/src/common/utils/__tests__/eventsManager.test.ts @@ -22,7 +22,7 @@ describe('cloneEvent()', () => { timeWarning: 120000, timeDanger: 60000, custom: { - lighting: { value: '3' }, + lighting: '3', } as EventCustomFields, } as OntimeEvent; diff --git a/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx b/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx index da042e9ca..88d63de0a 100644 --- a/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx +++ b/apps/client/src/features/app-settings/panel/sources-panel/preview/PreviewRundown.tsx @@ -101,7 +101,7 @@ export default function PreviewRundown(props: PreviewRundownProps) { fieldHeaders.map((field) => { let value = ''; if (field in event.custom) { - value = event.custom[field].value; + value = event.custom[field]; } return {value}; })} diff --git a/apps/client/src/features/cuesheet/CuesheetWrapper.tsx b/apps/client/src/features/cuesheet/CuesheetWrapper.tsx index 7dce5d362..733aeb40f 100644 --- a/apps/client/src/features/cuesheet/CuesheetWrapper.tsx +++ b/apps/client/src/features/cuesheet/CuesheetWrapper.tsx @@ -53,7 +53,7 @@ export default function CuesheetWrapper() { return; } - const previousValue = event.custom[accessor]?.value; + const previousValue = event.custom[accessor]; if (previousValue === payload) { return; diff --git a/apps/client/src/features/cuesheet/cuesheetCols.tsx b/apps/client/src/features/cuesheet/cuesheetCols.tsx index cbbde5277..9df415af4 100644 --- a/apps/client/src/features/cuesheet/cuesheetCols.tsx +++ b/apps/client/src/features/cuesheet/cuesheetCols.tsx @@ -49,7 +49,7 @@ function MakeCustomField({ row, column, table }: CellContext; } diff --git a/apps/client/src/features/cuesheet/cuesheetUtils.ts b/apps/client/src/features/cuesheet/cuesheetUtils.ts index 51334ac07..a70305d83 100644 --- a/apps/client/src/features/cuesheet/cuesheetUtils.ts +++ b/apps/client/src/features/cuesheet/cuesheetUtils.ts @@ -87,7 +87,7 @@ export const makeTable = (headerData: ProjectData, rundown: OntimeRundown, custo // for custom fields, we need to extract the value from the custom object if (field.startsWith('custom-')) { const fieldLabel = field.split('custom-')[1]; - const value = entry.custom[fieldLabel]?.value; + const value = entry.custom[fieldLabel]; row.push(parseField(fieldLabel, value)); } else { // @ts-expect-error -- it is ok, we will just not have the data for other fields diff --git a/apps/client/src/features/operator/Operator.tsx b/apps/client/src/features/operator/Operator.tsx index 10eb56f6c..636f8f5d5 100644 --- a/apps/client/src/features/operator/Operator.tsx +++ b/apps/client/src/features/operator/Operator.tsx @@ -173,7 +173,7 @@ export default function Operator() { const mainField = main ? entry?.[main] || entry.title : entry.title; const secondaryField = getPropertyValue(entry, secondary) ?? ''; - const subscribedData = entry.custom[subscribe]?.value; + const subscribedData = entry.custom[subscribe]; return ( { if (field.startsWith('custom-')) { const fieldLabel = field.split('custom-')[1]; - updateEvent({ id: event?.id, custom: { [fieldLabel]: { value } } }); + updateEvent({ id: event?.id, custom: { [fieldLabel]: value } }); } else { updateEvent({ id: event?.id, [field]: value }); } @@ -111,7 +111,7 @@ export default function EventEditor() { {Object.keys(customFields).map((label) => { const key = `${event.id}-${label}`; const fieldName = `custom-${label}`; - const initialValue = event.custom[label]?.value ?? ''; + const initialValue = event.custom[label] ?? ''; const { backgroundColor, color } = getAccessibleColour(customFields[label].colour); return ( diff --git a/apps/client/src/features/viewers/common/viewUtils.ts b/apps/client/src/features/viewers/common/viewUtils.ts index e4fd95984..a3b44888f 100644 --- a/apps/client/src/features/viewers/common/viewUtils.ts +++ b/apps/client/src/features/viewers/common/viewUtils.ts @@ -50,7 +50,7 @@ export function getPropertyValue(event: OntimeEvent | null, property: MaybeStrin if (property.startsWith('custom-')) { const field = property.split('custom-')[1]; - return event.custom?.[field]?.value; + return event.custom?.[field]; } return event[property as keyof OntimeEvent] as string; diff --git a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts index c5e735848..d2fe02e5c 100644 --- a/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts +++ b/apps/server/src/services/rundown-service/__tests__/rundownCache.test.ts @@ -304,15 +304,15 @@ describe('generate()', () => { type: SupportedEvent.Event, id: '1', custom: { - lighting: { value: 'event 1 lx' }, + lighting: 'event 1 lx', } as EventCustomFields, } as OntimeEvent, { type: SupportedEvent.Event, id: '2', custom: { - lighting: { value: 'event 2 lx' }, - sound: { value: 'event 2 sound' }, + lighting: 'event 2 lx', + sound: 'event 2 sound', } as EventCustomFields, } as OntimeEvent, ]; @@ -322,10 +322,10 @@ describe('generate()', () => { lighting: ['1', '2'], sound: ['2'], }); - expect((initResult.rundown['1'] as OntimeEvent).custom).toMatchObject({ lighting: { value: 'event 1 lx' } }); + expect((initResult.rundown['1'] as OntimeEvent).custom).toMatchObject({ lighting: 'event 1 lx' }); expect((initResult.rundown['2'] as OntimeEvent).custom).toMatchObject({ - lighting: { value: 'event 2 lx' }, - sound: { value: 'event 2 sound' }, + lighting: 'event 2 lx', + sound: 'event 2 sound', }); }); }); diff --git a/apps/server/src/services/rundown-service/__tests__/rundownCacheUtils.test.ts b/apps/server/src/services/rundown-service/__tests__/rundownCacheUtils.test.ts index 5dbcc6a34..80035c712 100644 --- a/apps/server/src/services/rundown-service/__tests__/rundownCacheUtils.test.ts +++ b/apps/server/src/services/rundown-service/__tests__/rundownCacheUtils.test.ts @@ -105,7 +105,7 @@ describe('handleCustomField()', () => { timeStart: 0, linkStart: '1', custom: { - lighting: { value: 'on' }, + lighting: 'on', }, }; const assignedCustomFields = {}; @@ -114,7 +114,7 @@ describe('handleCustomField()', () => { expect(result).toBeUndefined(); expect(assignedCustomFields).toStrictEqual({ lighting: ['2'] }); expect(event.custom).toStrictEqual({ - lighting: { value: 'on' }, + lighting: 'on', }); }); @@ -143,7 +143,7 @@ describe('handleCustomField()', () => { timeStart: 0, linkStart: '1', custom: { - sound: { value: 'on' }, + sound: 'on', }, }; const assignedCustomFields = {}; @@ -152,7 +152,7 @@ describe('handleCustomField()', () => { expect(result).toBeUndefined(); expect(assignedCustomFields).toStrictEqual({ video: ['2'] }); expect(event.custom).toStrictEqual({ - video: { value: 'on' }, + video: 'on', }); }); @@ -179,8 +179,8 @@ describe('handleCustomField()', () => { type: SupportedEvent.Event, id: 'event1', custom: { - field1: { value: 'value1' }, - field2: { value: 'value2' }, + field1: 'value1', + field2: 'value2', }, }; @@ -189,11 +189,11 @@ describe('handleCustomField()', () => { handleCustomField(customFields, customFieldChangelog, mutableEvent, assignedCustomFields); // Check that field1 has been renamed to newField1 and the value reassigned - expect(mutableEvent.custom['newField1']).toStrictEqual({ value: 'value1' }); + expect(mutableEvent.custom['newField1']).toStrictEqual('value1'); expect(mutableEvent.custom['field1']).toBeUndefined(); // Check that field2 has been processed - expect(mutableEvent.custom['field2']).toStrictEqual({ value: 'value2' }); + expect(mutableEvent.custom['field2']).toStrictEqual('value2'); // Check that assignedCustomFields has been updated correctly expect(assignedCustomFields).toStrictEqual({ @@ -232,7 +232,7 @@ describe('isDataStale()', () => { timeWarning: 1, timeDanger: 2, custom: { - lighting: { value: '3' }, + lighting: '3', }, }), ).toBe(false); diff --git a/apps/server/src/services/rundown-service/rundownCacheUtils.ts b/apps/server/src/services/rundown-service/rundownCacheUtils.ts index e38604fb3..f9dbe4a6a 100644 --- a/apps/server/src/services/rundown-service/rundownCacheUtils.ts +++ b/apps/server/src/services/rundown-service/rundownCacheUtils.ts @@ -83,7 +83,7 @@ export function handleCustomField( const oldData = mutableEvent.custom[field]; const newLabel = customFieldChangelog[field]; - mutableEvent.custom[newLabel] = { ...oldData }; + mutableEvent.custom[newLabel] = oldData; delete mutableEvent.custom[field]; addToCustomAssignment(newLabel, mutableEvent.id, assignedCustomFields); continue; diff --git a/apps/server/src/utils/__tests__/parser.test.ts b/apps/server/src/utils/__tests__/parser.test.ts index 002d09c86..12e3aa035 100644 --- a/apps/server/src/utils/__tests__/parser.test.ts +++ b/apps/server/src/utils/__tests__/parser.test.ts @@ -883,16 +883,16 @@ describe('parseExcel()', () => { skip: false, note: 'Ballyhoo', custom: { - user0: { value: 'a0' }, - user1: { value: 'a1' }, - user2: { value: 'a2' }, - user3: { value: 'a3' }, - user4: { value: 'a4' }, - user5: { value: 'a5' }, - user6: { value: 'a6' }, - user7: { value: 'a7' }, - user8: { value: 'a8' }, - user9: { value: 'a9' }, + user0: 'a0', + user1: 'a1', + user2: 'a2', + user3: 'a3', + user4: 'a4', + user5: 'a5', + user6: 'a6', + user7: 'a7', + user8: 'a8', + user9: 'a9', }, colour: 'red', type: 'event', @@ -908,8 +908,8 @@ describe('parseExcel()', () => { skip: true, note: 'Rainbow chase', custom: { - user0: { value: 'b0' }, - user5: { value: 'b5' }, + user0: 'b0', + user5: 'b5', }, colour: '#F00', type: 'event', diff --git a/apps/server/src/utils/parser.ts b/apps/server/src/utils/parser.ts index c9317a23c..b58f5e6db 100644 --- a/apps/server/src/utils/parser.ts +++ b/apps/server/src/utils/parser.ts @@ -214,7 +214,7 @@ export const parseExcel = (excelData: unknown[][], options?: Partial) } else if (j in customFieldIndexes) { const importKey = customFieldIndexes[j]; const ontimeKey = customFieldImportKeys[importKey]; - eventCustomFields[ontimeKey] = { value: makeString(column, '') }; + eventCustomFields[ontimeKey] = makeString(column, ''); } else { // 2. if there is no flag, lets see if we know the field type if (typeof column === 'string') { diff --git a/packages/types/src/definitions/core/CustomFields.type.ts b/packages/types/src/definitions/core/CustomFields.type.ts index 5c800333c..cb5807919 100644 --- a/packages/types/src/definitions/core/CustomFields.type.ts +++ b/packages/types/src/definitions/core/CustomFields.type.ts @@ -7,4 +7,4 @@ export type CustomField = { }; export type CustomFields = Record; -export type EventCustomFields = Record; +export type EventCustomFields = Record;