Skip to content

Commit 2cdd8d3

Browse files
committed
wip: combine settings
1 parent ed69aca commit 2cdd8d3

File tree

24 files changed

+256
-122
lines changed

24 files changed

+256
-122
lines changed

meteor/__mocks__/helpers/database.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export async function setupMockPeripheralDevice(
127127
_id: protectString('mockDevice' + dbI++),
128128
name: 'mockDevice',
129129
organizationId: null,
130-
studioId: studio ? studio._id : undefined,
130+
studioAndConfigId: studio ? { studioId: studio._id, configId: 'test' } : undefined,
131131

132132
category: category,
133133
type: type,

meteor/server/api/__tests__/peripheralDevice.test.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ describe('test peripheralDevice general API methods', () => {
412412
expect(QueueStudioJobSpy).toHaveBeenNthCalledWith(
413413
1,
414414
StudioJobs.OnPlayoutPlaybackChanged,
415-
device.studioId,
415+
device.studioAndConfigId!.studioId,
416416
literal<Parameters<StudioJobFunc[StudioJobs.OnPlayoutPlaybackChanged]>[0]>({
417417
playlistId: rundownPlaylistID,
418418
changes: [
@@ -474,7 +474,7 @@ describe('test peripheralDevice general API methods', () => {
474474
expect(QueueStudioJobSpy).toHaveBeenNthCalledWith(
475475
1,
476476
StudioJobs.OnTimelineTriggerTime,
477-
device.studioId,
477+
device.studioAndConfigId!.studioId,
478478
literal<OnTimelineTriggerTimeProps>({
479479
results: timelineTriggerTimeResult,
480480
})
@@ -643,7 +643,10 @@ describe('test peripheralDevice general API methods', () => {
643643
organizationId: null,
644644
name: 'Mock Media Manager',
645645
deviceName: 'Media Manager',
646-
studioId: env.studio._id,
646+
studioAndConfigId: {
647+
studioId: env.studio._id,
648+
configId: 'test',
649+
},
647650
category: PeripheralDeviceCategory.MEDIA_MANAGER,
648651
configManifest: {
649652
deviceConfigSchema: JSONBlobStringify({}),
@@ -669,7 +672,7 @@ describe('test peripheralDevice general API methods', () => {
669672
deviceId: device._id,
670673
priority: 1,
671674
source: 'MockSource',
672-
studioId: device.studioId!,
675+
studioId: device.studioAndConfigId!.studioId,
673676
finished: false,
674677
success: false,
675678
})
@@ -681,7 +684,7 @@ describe('test peripheralDevice general API methods', () => {
681684
deviceId: device._id,
682685
priority: 2,
683686
status: MediaManagerAPI.WorkStepStatus.IDLE,
684-
studioId: device.studioId!,
687+
studioId: device.studioAndConfigId!.studioId,
685688
workFlowId: workFlowId,
686689
})
687690
await MediaWorkFlowSteps.insertAsync({
@@ -692,14 +695,14 @@ describe('test peripheralDevice general API methods', () => {
692695
deviceId: device._id,
693696
priority: 1,
694697
status: MediaManagerAPI.WorkStepStatus.IDLE,
695-
studioId: device.studioId!,
698+
studioId: device.studioAndConfigId!.studioId,
696699
workFlowId: workFlowId,
697700
})
698701
})
699702
test('getMediaWorkFlowRevisions', async () => {
700703
const workFlows = (
701704
await MediaWorkFlows.findFetchAsync({
702-
studioId: device.studioId,
705+
studioId: device.studioAndConfigId!.studioId,
703706
})
704707
).map((wf) => ({
705708
_id: wf._id,
@@ -713,7 +716,7 @@ describe('test peripheralDevice general API methods', () => {
713716
test('getMediaWorkFlowStepRevisions', async () => {
714717
const workFlowSteps = (
715718
await MediaWorkFlowSteps.findFetchAsync({
716-
studioId: device.studioId,
719+
studioId: device.studioAndConfigId!.studioId,
717720
})
718721
).map((wf) => ({
719722
_id: wf._id,
@@ -798,7 +801,10 @@ describe('test peripheralDevice general API methods', () => {
798801
organizationId: null,
799802
name: 'Mock Media Manager',
800803
deviceName: 'Media Manager',
801-
studioId: env.studio._id,
804+
studioAndConfigId: {
805+
studioId: env.studio._id,
806+
configId: 'test',
807+
},
802808
category: PeripheralDeviceCategory.MEDIA_MANAGER,
803809
configManifest: {
804810
deviceConfigSchema: JSONBlobStringify({}),
@@ -832,7 +838,7 @@ describe('test peripheralDevice general API methods', () => {
832838
mediaSize: 10,
833839
mediaTime: 0,
834840
objId: MOCK_OBJID,
835-
studioId: device.studioId!,
841+
studioId: device.studioAndConfigId!.studioId,
836842
thumbSize: 0,
837843
thumbTime: 0,
838844
tinf: '',
@@ -841,7 +847,7 @@ describe('test peripheralDevice general API methods', () => {
841847
test('getMediaObjectRevisions', async () => {
842848
const mobjects = (
843849
await MediaObjects.findFetchAsync({
844-
studioId: device.studioId,
850+
studioId: device.studioAndConfigId!.studioId,
845851
})
846852
).map((mo) => ({
847853
_id: mo._id,
@@ -862,7 +868,7 @@ describe('test peripheralDevice general API methods', () => {
862868
test('update', async () => {
863869
const mo = (await MediaObjects.findOneAsync({
864870
collectionId: MOCK_COLLECTION,
865-
studioId: device.studioId!,
871+
studioId: device.studioAndConfigId!.studioId,
866872
})) as MediaObject
867873
expect(mo).toBeTruthy()
868874

@@ -880,14 +886,14 @@ describe('test peripheralDevice general API methods', () => {
880886

881887
const updateMo = await MediaObjects.findOneAsync({
882888
collectionId: MOCK_COLLECTION,
883-
studioId: device.studioId!,
889+
studioId: device.studioAndConfigId!.studioId,
884890
})
885891
expect(updateMo).toMatchObject(newMo)
886892
})
887893
test('remove', async () => {
888894
const mo = (await MediaObjects.findOneAsync({
889895
collectionId: MOCK_COLLECTION,
890-
studioId: device.studioId!,
896+
studioId: device.studioAndConfigId!.studioId,
891897
})) as MediaObject
892898
expect(mo).toBeTruthy()
893899

@@ -901,7 +907,7 @@ describe('test peripheralDevice general API methods', () => {
901907

902908
const updateMo = await MediaObjects.findOneAsync({
903909
collectionId: MOCK_COLLECTION,
904-
studioId: device.studioId!,
910+
studioId: device.studioAndConfigId!.studioId,
905911
})
906912
expect(updateMo).toBeFalsy()
907913
})

meteor/server/api/deviceTriggers/observer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export async function receiveInputDeviceTrigger(
102102
check(deviceId, String)
103103
check(triggerId, String)
104104

105-
const studioId = peripheralDevice.studioId
105+
const studioId = peripheralDevice.studioAndConfigId?.studioId
106106
if (!studioId) throw new Meteor.Error(400, `Peripheral Device "${peripheralDevice._id}" not assigned to a studio`)
107107

108108
logger.debug(

meteor/server/api/integration/expectedPackages.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export namespace PackageManagerIntegration {
5858
type FromPackage = Omit<ExpectedPackageStatusAPI.WorkBaseInfoFromPackage, 'id'> & { id: ExpectedPackageId }
5959

6060
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
61-
if (!peripheralDevice.studioId)
61+
if (!peripheralDevice.studioAndConfigId)
6262
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
6363

6464
const bulkChanges: AnyBulkWriteOperation<ExpectedPackageWorkStatus>[] = []
@@ -153,7 +153,7 @@ export namespace PackageManagerIntegration {
153153
$or: [
154154
{ deviceId: peripheralDevice._id },
155155
// Since we only have one PM in a studio, we can remove everything in the studio:
156-
{ studioId: peripheralDevice.studioId },
156+
{ studioId: peripheralDevice.studioAndConfigId.studioId },
157157
],
158158
})
159159
}
@@ -177,10 +177,10 @@ export namespace PackageManagerIntegration {
177177
)[]
178178
): Promise<void> {
179179
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
180-
if (!peripheralDevice.studioId)
180+
if (!peripheralDevice.studioAndConfigId)
181181
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
182182

183-
const studioId = peripheralDevice.studioId
183+
const studioId = peripheralDevice.studioAndConfigId.studioId
184184

185185
const removedIds: PackageContainerPackageId[] = []
186186
const ps: Promise<unknown>[] = []
@@ -189,7 +189,7 @@ export namespace PackageManagerIntegration {
189189
check(change.packageId, String)
190190

191191
const id = getPackageContainerPackageId(
192-
peripheralDevice.studioId,
192+
peripheralDevice.studioAndConfigId.studioId,
193193
change.containerId,
194194
protectString(change.packageId)
195195
)
@@ -248,7 +248,7 @@ export namespace PackageManagerIntegration {
248248
$or: [
249249
{ deviceId: peripheralDevice._id },
250250
// Since we only have one PM in a studio, we can remove everything in the studio:
251-
{ studioId: peripheralDevice.studioId },
251+
{ studioId: peripheralDevice.studioAndConfigId.studioId },
252252
],
253253
})
254254
}
@@ -270,17 +270,17 @@ export namespace PackageManagerIntegration {
270270
)[]
271271
): Promise<void> {
272272
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
273-
if (!peripheralDevice.studioId)
273+
if (!peripheralDevice.studioAndConfigId)
274274
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
275275

276-
const studioId = peripheralDevice.studioId
276+
const studioId = peripheralDevice.studioAndConfigId.studioId
277277

278278
const removedIds: PackageContainerId[] = []
279279
const ps: Promise<unknown>[] = []
280280
for (const change of changes) {
281281
check(change.containerId, String)
282282

283-
const id = getPackageContainerId(peripheralDevice.studioId, change.containerId)
283+
const id = getPackageContainerId(peripheralDevice.studioAndConfigId.studioId, change.containerId)
284284

285285
if (change.type === 'delete') {
286286
removedIds.push(id)
@@ -335,7 +335,7 @@ export namespace PackageManagerIntegration {
335335
$or: [
336336
{ deviceId: peripheralDevice._id },
337337
// Since we only have one PM in a studio, we can remove everything in the studio:
338-
{ studioId: peripheralDevice.studioId },
338+
{ studioId: peripheralDevice.studioAndConfigId.studioId },
339339
],
340340
})
341341
}
@@ -352,7 +352,7 @@ export namespace PackageManagerIntegration {
352352
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
353353
check(packageIds, [String])
354354
check(type, String)
355-
if (!peripheralDevice.studioId)
355+
if (!peripheralDevice.studioAndConfigId)
356356
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
357357

358358
const ids = packageIds.map((packageId) => getPackageInfoId(packageId, type))
@@ -386,7 +386,7 @@ export namespace PackageManagerIntegration {
386386
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
387387
check(packageId, String)
388388
check(type, String)
389-
if (!peripheralDevice.studioId)
389+
if (!peripheralDevice.studioAndConfigId)
390390
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
391391

392392
const id = getPackageInfoId(packageId, type)
@@ -398,7 +398,7 @@ export namespace PackageManagerIntegration {
398398
expectedContentVersionHash: expectedContentVersionHash,
399399
actualContentVersionHash: actualContentVersionHash,
400400

401-
studioId: peripheralDevice.studioId,
401+
studioId: peripheralDevice.studioAndConfigId.studioId,
402402

403403
deviceId: peripheralDevice._id,
404404

@@ -425,7 +425,7 @@ export namespace PackageManagerIntegration {
425425
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
426426
check(packageId, String)
427427
check(type, String)
428-
if (!peripheralDevice.studioId)
428+
if (!peripheralDevice.studioAndConfigId)
429429
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
430430

431431
const id = getPackageInfoId(packageId, type)

meteor/server/api/integration/mediaWorkFlows.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export namespace MediaManagerIntegration {
2222
logger.debug('getMediaWorkFlowStepRevisions')
2323
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
2424

25-
if (peripheralDevice.studioId) {
25+
if (peripheralDevice.studioAndConfigId) {
2626
const rawSteps = (await MediaWorkFlowSteps.findFetchAsync(
2727
{
28-
studioId: peripheralDevice.studioId,
28+
studioId: peripheralDevice.studioAndConfigId.studioId,
2929
},
3030
{
3131
fields: {
@@ -54,10 +54,10 @@ export namespace MediaManagerIntegration {
5454
logger.debug('getMediaWorkFlowRevisions')
5555
const peripheralDevice = await checkAccessAndGetPeripheralDevice(deviceId, deviceToken, context)
5656

57-
if (peripheralDevice.studioId) {
57+
if (peripheralDevice.studioAndConfigId) {
5858
const rawWorkflows = (await MediaWorkFlows.findFetchAsync(
5959
{
60-
studioId: peripheralDevice.studioId,
60+
studioId: peripheralDevice.studioAndConfigId.studioId,
6161
},
6262
{
6363
fields: {
@@ -91,7 +91,7 @@ export namespace MediaManagerIntegration {
9191
400,
9292
`Device "${peripheralDevice._id}".type is "${peripheralDevice.type}", should be MEDIA_MANAGER `
9393
)
94-
if (!peripheralDevice.studioId)
94+
if (!peripheralDevice.studioAndConfigId)
9595
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
9696

9797
check(workFlowId, String)
@@ -100,7 +100,7 @@ export namespace MediaManagerIntegration {
100100
if (obj) {
101101
check(obj._id, String)
102102
obj.deviceId = peripheralDevice._id
103-
obj.studioId = peripheralDevice.studioId
103+
obj.studioId = peripheralDevice.studioAndConfigId.studioId
104104

105105
await MediaWorkFlows.upsertAsync(workFlowId, obj)
106106

@@ -131,7 +131,7 @@ export namespace MediaManagerIntegration {
131131
400,
132132
`Device "${peripheralDevice._id}".type is "${peripheralDevice.type}", should be MEDIA_MANAGER `
133133
)
134-
if (!peripheralDevice.studioId)
134+
if (!peripheralDevice.studioAndConfigId)
135135
throw new Meteor.Error(400, 'Device "' + peripheralDevice._id + '" has no studio')
136136

137137
check(stepId, String)
@@ -147,7 +147,7 @@ export namespace MediaManagerIntegration {
147147

148148
obj.workFlowId = workflow._id
149149
obj.deviceId = peripheralDevice._id
150-
obj.studioId = peripheralDevice.studioId
150+
obj.studioId = peripheralDevice.studioAndConfigId.studioId
151151

152152
await MediaWorkFlowSteps.upsertAsync(stepId, obj)
153153
} else {

0 commit comments

Comments
 (0)