Skip to content

Commit de8774a

Browse files
authored
feat: remove remnants of 'organisations' (Sofie-Automation#1535)
1 parent 38439f9 commit de8774a

File tree

66 files changed

+66
-486
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+66
-486
lines changed

meteor/__mocks__/defaultCollectionObjects.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function defaultRundownPlaylist(_id: RundownPlaylistId, studioId: StudioI
3636
_id: _id,
3737

3838
externalId: 'MOCK_RUNDOWNPLAYLIST',
39-
organizationId: null,
4039
studioId: studioId,
4140

4241
name: 'Default RundownPlaylist',
@@ -67,8 +66,6 @@ export function defaultRundown(
6766
showStyleBaseId: showStyleBaseId,
6867
showStyleVariantId: showStyleVariantId,
6968

70-
organizationId: null,
71-
7269
playlistId: playlistId,
7370

7471
_id: getRundownId(studioId, externalId),
@@ -101,7 +98,6 @@ export function defaultStudio(_id: StudioId): DBStudio {
10198
_id: _id,
10299

103100
name: 'mockStudio',
104-
organizationId: null,
105101
mappingsWithOverrides: wrapDefaultObject({}),
106102
supportedShowStyleBase: [],
107103
blueprintConfigWithOverrides: wrapDefaultObject({}),

meteor/__mocks__/helpers/database.ts

Lines changed: 14 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ import {
6969
import { UIShowStyleBase } from '@sofie-automation/meteor-lib/dist/api/showStyles'
7070
import {
7171
BlueprintId,
72-
OrganizationId,
7372
RundownId,
7473
RundownPlaylistId,
7574
ShowStyleBaseId,
@@ -126,7 +125,6 @@ export async function setupMockPeripheralDevice(
126125
const defaultDevice: PeripheralDevice = {
127126
_id: protectString('mockDevice' + dbI++),
128127
name: 'mockDevice',
129-
organizationId: null,
130128
studioAndConfigId: studio ? { studioId: studio._id, configId: 'test' } : undefined,
131129

132130
category: category,
@@ -259,7 +257,6 @@ export async function setupMockShowStyleBase(
259257
const defaultShowStyleBase: DBShowStyleBase = {
260258
_id: protectString('mockShowStyleBase' + dbI++),
261259
name: 'mockShowStyleBase',
262-
organizationId: null,
263260
outputLayersWithOverrides: wrapDefaultObject(
264261
normalizeArray(
265262
[
@@ -354,10 +351,7 @@ export function packageBlueprint<T extends BlueprintManifestBase>(
354351
})
355352
return `({default: (${code})()})`
356353
}
357-
export async function setupMockStudioBlueprint(
358-
showStyleBaseId: ShowStyleBaseId,
359-
organizationId: OrganizationId | null = null
360-
): Promise<Blueprint> {
354+
export async function setupMockStudioBlueprint(showStyleBaseId: ShowStyleBaseId): Promise<Blueprint> {
361355
const { INTEGRATION_VERSION, TSR_VERSION } = getBlueprintDependencyVersions()
362356

363357
const BLUEPRINT_TYPE = BlueprintManifestType.STUDIO
@@ -401,20 +395,12 @@ export async function setupMockStudioBlueprint(
401395
const blueprintId: BlueprintId = protectString('mockBlueprint' + dbI++)
402396
const blueprintName = 'mockBlueprint'
403397

404-
return internalUploadBlueprint(
405-
blueprintId,
406-
code,
407-
{
408-
blueprintName,
409-
ignoreIdChange: true,
410-
},
411-
organizationId
412-
)
398+
return internalUploadBlueprint(blueprintId, code, {
399+
blueprintName,
400+
ignoreIdChange: true,
401+
})
413402
}
414-
export async function setupMockShowStyleBlueprint(
415-
showStyleVariantId: ShowStyleVariantId,
416-
organizationId?: OrganizationId | null
417-
): Promise<Blueprint> {
403+
export async function setupMockShowStyleBlueprint(showStyleVariantId: ShowStyleVariantId): Promise<Blueprint> {
418404
const { INTEGRATION_VERSION, TSR_VERSION } = getBlueprintDependencyVersions()
419405

420406
const BLUEPRINT_TYPE = BlueprintManifestType.SHOWSTYLE
@@ -540,15 +526,10 @@ export async function setupMockShowStyleBlueprint(
540526
const blueprintId: BlueprintId = protectString('mockBlueprint' + dbI++)
541527
const blueprintName = 'mockBlueprint'
542528

543-
return internalUploadBlueprint(
544-
blueprintId,
545-
code,
546-
{
547-
blueprintName,
548-
ignoreIdChange: true,
549-
},
550-
organizationId
551-
)
529+
return internalUploadBlueprint(blueprintId, code, {
530+
blueprintName,
531+
ignoreIdChange: true,
532+
})
552533
}
553534
export interface DefaultEnvironment {
554535
showStyleBaseId: ShowStyleBaseId
@@ -567,36 +548,31 @@ export interface DefaultEnvironment {
567548

568549
ingestDevice: PeripheralDevice
569550
}
570-
export async function setupDefaultStudioEnvironment(
571-
organizationId: OrganizationId | null = null
572-
): Promise<DefaultEnvironment> {
551+
export async function setupDefaultStudioEnvironment(): Promise<DefaultEnvironment> {
573552
const core = await setupMockCore({})
574553
const systemTriggeredActions = await setupMockTriggeredActions()
575554

576555
const showStyleBaseId: ShowStyleBaseId = getRandomId()
577556
const showStyleVariantId: ShowStyleVariantId = getRandomId()
578557

579-
const studioBlueprint = await setupMockStudioBlueprint(showStyleBaseId, organizationId)
580-
const showStyleBlueprint = await setupMockShowStyleBlueprint(showStyleVariantId, organizationId)
558+
const studioBlueprint = await setupMockStudioBlueprint(showStyleBaseId)
559+
const showStyleBlueprint = await setupMockShowStyleBlueprint(showStyleVariantId)
581560

582561
const showStyleBase = await setupMockShowStyleBase(showStyleBlueprint._id, {
583562
_id: showStyleBaseId,
584-
organizationId: organizationId,
585563
})
586564
const triggeredActions = await setupMockTriggeredActions(showStyleBase._id)
587565
const showStyleVariant = await setupMockShowStyleVariant(showStyleBase._id, { _id: showStyleVariantId })
588566

589567
const studio = await setupMockStudio({
590568
blueprintId: studioBlueprint._id,
591569
supportedShowStyleBase: [showStyleBaseId],
592-
organizationId: organizationId,
593570
})
594571
const ingestDevice = await setupMockPeripheralDevice(
595572
PeripheralDeviceCategory.INGEST,
596573
PeripheralDeviceType.MOS,
597574
PERIPHERAL_SUBTYPE_PROCESS,
598-
studio,
599-
{ organizationId: organizationId }
575+
studio
600576
)
601577
const { worker, workerThreadStatuses } = await setupMockWorker()
602578

@@ -648,7 +624,6 @@ export async function setupDefaultRundown(
648624
const sourceLayerIds = Object.keys(applyAndValidateOverrides(env.showStyleBase.sourceLayersWithOverrides).obj)
649625

650626
const rundown: DBRundown = {
651-
organizationId: null,
652627
studioId: env.studio._id,
653628
showStyleBaseId: env.showStyleBase._id,
654629
showStyleVariantId: env.showStyleVariant._id,

meteor/server/__tests__/cronjobs.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ describe('cronjobs', () => {
423423
const userAction0 = protectString<UserActionsLogItemId>(getRandomString())
424424
await UserActionsLog.insertAsync({
425425
_id: userAction0,
426-
organizationId: null,
427426
userId: null,
428427
args: '',
429428
clientAddress: '',
@@ -436,7 +435,6 @@ describe('cronjobs', () => {
436435
const userAction1 = protectString<UserActionsLogItemId>(getRandomString())
437436
await UserActionsLog.insertAsync({
438437
_id: userAction1,
439-
organizationId: null,
440438
userId: null,
441439
args: '',
442440
clientAddress: '',
@@ -457,7 +455,6 @@ describe('cronjobs', () => {
457455
const snapshot0 = protectString<SnapshotId>(getRandomString())
458456
await Snapshots.insertAsync({
459457
_id: snapshot0,
460-
organizationId: null,
461458
comment: '',
462459
fileName: '',
463460
name: '',
@@ -470,7 +467,6 @@ describe('cronjobs', () => {
470467
const snapshot1 = protectString<SnapshotId>(getRandomString())
471468
await Snapshots.insertAsync({
472469
_id: snapshot1,
473-
organizationId: null,
474470
comment: '',
475471
fileName: '',
476472
name: '',
@@ -497,7 +493,6 @@ describe('cronjobs', () => {
497493
const deviceId = protectString<PeripheralDeviceId>(getRandomString())
498494
await PeripheralDevices.insertAsync({
499495
_id: deviceId,
500-
organizationId: null,
501496
type: PeripheralDeviceType.PLAYOUT,
502497
category: PeripheralDeviceCategory.PLAYOUT,
503498
configManifest: {
@@ -577,7 +572,6 @@ describe('cronjobs', () => {
577572
const studioId = protectString<StudioId>(getRandomString())
578573
await Studios.insertAsync({
579574
_id: studioId,
580-
organizationId: null,
581575
name: 'Studio',
582576
blueprintConfigWithOverrides: newObjectWithOverrides({}),
583577
_rundownVersionHash: '',

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import { Collections } from '../../collections/lib'
5151
import { generateTranslationBundleOriginId } from '../translationsBundles'
5252
import { CollectionCleanupResult } from '@sofie-automation/meteor-lib/dist/api/system'
5353
import { DBNotificationTargetType } from '@sofie-automation/corelib/dist/dataModel/Notifications'
54+
import { CollectionName } from '@sofie-automation/corelib/dist/dataModel/Collections'
5455

5556
describe('Cleanup', () => {
5657
let env: DefaultEnvironment
@@ -67,6 +68,15 @@ describe('Cleanup', () => {
6768
expect(typeof result).not.toBe('string')
6869

6970
for (const name of Collections.keys()) {
71+
// Some collections have no 'owner'
72+
if (
73+
name === CollectionName.Blueprints ||
74+
name === CollectionName.Studios ||
75+
name === CollectionName.ShowStyleBases ||
76+
name === CollectionName.PeripheralDevices
77+
)
78+
continue
79+
7080
// Check that the collection has been handled in the function cleanupOldDataInner:
7181
expect(result).toHaveProperty(name)
7282
}
@@ -248,7 +258,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
248258
await Evaluations.insertAsync({
249259
_id: getRandomId(),
250260
answers: {} as any,
251-
organizationId: null,
252261
playlistId,
253262
studioId,
254263
timestamp: now,
@@ -401,7 +410,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
401410
created: now,
402411
fileName: '',
403412
name: '',
404-
organizationId: null,
405413
type: '' as any,
406414
version: '',
407415
})
@@ -427,7 +435,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
427435
clientAddress: '',
428436
context: '',
429437
method: '',
430-
organizationId: null,
431438
timestamp: now,
432439
userId: null,
433440
})
@@ -469,7 +476,6 @@ async function setDefaultDatatoDB(env: DefaultEnvironment, now: number) {
469476
if (
470477
[
471478
// Ignore these:
472-
'organizations',
473479
'Users',
474480
// Deprecated:
475481
'mediaObjects',

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ describe('Test external message queue static methods', () => {
6464
peripheralDeviceId: studioEnv.ingestDevice._id,
6565
nrcsName: 'mockNRCS',
6666
},
67-
organizationId: protectString(''),
6867
timing: {
6968
type: PlaylistTimingType.None,
7069
},

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ describe('test peripheralDevice general API methods', () => {
9999
peripheralDeviceId: env.ingestDevice._id,
100100
nrcsName: 'mockNRCS',
101101
},
102-
organizationId: protectString(''),
103102
timing: {
104103
type: PlaylistTimingType.None,
105104
},
@@ -630,7 +629,6 @@ describe('test peripheralDevice general API methods', () => {
630629
env = await setupDefaultStudioEnvironment()
631630
await PeripheralDevices.insertAsync({
632631
_id: deviceId,
633-
organizationId: null,
634632
name: 'Mock Media Manager',
635633
deviceName: 'Media Manager',
636634
studioAndConfigId: {

meteor/server/api/__tests__/userActions/system.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@ describe('User Actions - Disable Peripheral SubDevice', () => {
3131
const mockSubDeviceId = 'mockSubDevice0'
3232

3333
beforeEach(async () => {
34-
const organizationId = null
35-
env = await setupDefaultStudioEnvironment(organizationId)
34+
env = await setupDefaultStudioEnvironment()
3635
pDevice = await setupMockPeripheralDevice(
3736
PeripheralDeviceCategory.PLAYOUT,
3837
PeripheralDeviceType.PLAYOUT,
3938
PERIPHERAL_SUBTYPE_PROCESS,
4039
env.studio,
4140
{
42-
organizationId,
4341
configManifest: {
4442
deviceConfigSchema: JSONBlobStringify({}), // unused
4543
subdeviceManifest: {
@@ -163,7 +161,6 @@ describe('User Actions - Disable Peripheral SubDevice', () => {
163161
PERIPHERAL_SUBTYPE_PROCESS,
164162
env.studio,
165163
{
166-
organizationId: null,
167164
configManifest: {
168165
deviceConfigSchema: JSONBlobStringify({}), // unused
169166
subdeviceManifest: {

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ describe('Test blueprint management api', () => {
4141
const blueprint: Blueprint = {
4242
_id: getRandomId(),
4343
name: 'Fake blueprint',
44-
organizationId: null,
4544
hasCode: true,
4645
code: `({default: (() => 5)()})`,
4746
created: 0,
@@ -304,7 +303,6 @@ describe('Test blueprint management api', () => {
304303
literal<Omit<Blueprint, 'created' | 'modified' | 'databaseVersion' | 'blueprintHash'>>({
305304
_id: protectString('tmp_showstyle'),
306305
name: 'tmp_showstyle',
307-
organizationId: null,
308306
blueprintType: BLUEPRINT_TYPE,
309307
blueprintId: 'ss1',
310308
blueprintVersion: '0.1.0',
@@ -344,7 +342,6 @@ describe('Test blueprint management api', () => {
344342
literal<Omit<Blueprint, 'created' | 'modified' | 'databaseVersion' | 'blueprintHash'>>({
345343
_id: protectString('tmp_studio'),
346344
name: 'tmp name',
347-
organizationId: null,
348345
blueprintId: '',
349346
blueprintType: BLUEPRINT_TYPE,
350347
blueprintVersion: '0.1.0',
@@ -385,7 +382,6 @@ describe('Test blueprint management api', () => {
385382
literal<Omit<Blueprint, 'created' | 'modified' | 'databaseVersion' | 'blueprintHash'>>({
386383
_id: protectString('tmp_system'),
387384
name: 'tmp name',
388-
organizationId: null,
389385
blueprintId: 'sys',
390386
blueprintType: BLUEPRINT_TYPE,
391387
blueprintVersion: '0.1.0',
@@ -429,7 +425,6 @@ describe('Test blueprint management api', () => {
429425
literal<Omit<Blueprint, 'created' | 'modified' | 'databaseVersion' | 'blueprintHash'>>({
430426
_id: existingBlueprint._id,
431427
name: existingBlueprint.name,
432-
organizationId: null,
433428
blueprintId: '',
434429
blueprintType: BLUEPRINT_TYPE,
435430
blueprintVersion: '0.1.0',
@@ -475,7 +470,6 @@ describe('Test blueprint management api', () => {
475470
literal<Omit<Blueprint, 'created' | 'modified' | 'databaseVersion' | 'blueprintHash'>>({
476471
_id: existingBlueprint._id,
477472
name: existingBlueprint.name,
478-
organizationId: null,
479473
blueprintId: 'ss1',
480474
blueprintType: BLUEPRINT_TYPE,
481475
blueprintVersion: '0.1.0',

meteor/server/api/blueprints/__tests__/lib.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export function generateFakeBlueprint(
2828
return literal<Blueprint>({
2929
_id: protectString(id),
3030
name: 'Fake blueprint',
31-
organizationId: null,
3231
hasCode: true,
3332
code: `({default: (${codeFcnString})()})`,
3433
created: 0,

0 commit comments

Comments
 (0)