Skip to content

Commit 4c316a1

Browse files
committed
feat: move notification publications into corelib
1 parent 41770fe commit 4c316a1

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

meteor/server/publications/system.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { RundownId, RundownPlaylistId, StudioId } from '@sofie-automation/coreli
55
import { check } from 'meteor/check'
66
import { SYSTEM_ID } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
77
import { triggerWriteAccessBecauseNoCheckNecessary } from '../security/securityVerify'
8+
import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'
89

910
meteorPublish(MeteorPubSub.coreSystem, async function (_token: string | undefined) {
1011
triggerWriteAccessBecauseNoCheckNecessary()
@@ -26,7 +27,7 @@ meteorPublish(MeteorPubSub.coreSystem, async function (_token: string | undefine
2627
})
2728
})
2829

29-
meteorPublish(MeteorPubSub.notificationsForRundown, async function (studioId: StudioId, rundownId: RundownId) {
30+
meteorPublish(CorelibPubSub.notificationsForRundown, async function (studioId: StudioId, rundownId: RundownId) {
3031
// HACK: This should do real auth
3132
triggerWriteAccessBecauseNoCheckNecessary()
3233

@@ -41,7 +42,7 @@ meteorPublish(MeteorPubSub.notificationsForRundown, async function (studioId: St
4142
})
4243

4344
meteorPublish(
44-
MeteorPubSub.notificationsForRundownPlaylist,
45+
CorelibPubSub.notificationsForRundownPlaylist,
4546
async function (studioId: StudioId, playlistId: RundownPlaylistId) {
4647
// HACK: This should do real auth
4748
triggerWriteAccessBecauseNoCheckNecessary()

packages/corelib/src/pubsub.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import { BlueprintId, BucketId, RundownPlaylistActivationId, SegmentId, ShowStyl
3838
import { PackageInfoDB } from './dataModel/PackageInfos.js'
3939
import { UIPieceContentStatus } from './dataModel/PieceContentStatus.js'
4040
import { Bucket } from './dataModel/Bucket.js'
41+
import { DBNotificationObj } from './dataModel/Notifications.js'
4142

4243
/**
4344
* Ids of possible DDP subscriptions for any the UI and gateways accessing the Rundown & RundownPlaylist model.
@@ -130,6 +131,14 @@ export enum CorelibPubSub {
130131
* Fetch all Expected Package statuses in the specified Studios
131132
*/
132133
expectedPackageWorkStatuses = 'expectedPackageWorkStatuses',
134+
/**
135+
* Fetch notifications for playlist
136+
*/
137+
notificationsForRundownPlaylist = 'notificationsForRundownPlaylist',
138+
/**
139+
* Fetch notifications for rundown
140+
*/
141+
notificationsForRundown = 'notificationsForRundown',
133142
/**
134143
* Fetch all Package container statuses in the specified Studios
135144
*/
@@ -328,6 +337,11 @@ export interface CorelibPubSubTypes {
328337
studioIds: StudioId[],
329338
token?: string
330339
) => CollectionName.PackageContainerStatuses
340+
[CorelibPubSub.notificationsForRundown]: (studioId: StudioId, rundownId: RundownId) => CollectionName.Notifications
341+
[CorelibPubSub.notificationsForRundownPlaylist]: (
342+
studioId: StudioId,
343+
playlistId: RundownPlaylistId
344+
) => CollectionName.Notifications
331345
[CorelibPubSub.packageInfos]: (deviceId: PeripheralDeviceId, token?: string) => CollectionName.PackageInfos
332346

333347
[CorelibPubSub.uiPieceContentStatuses]: (
@@ -345,6 +359,7 @@ export type CorelibPubSubCollections = {
345359
[CollectionName.ExpectedPackages]: ExpectedPackageDBBase
346360
[CollectionName.ExpectedPackageWorkStatuses]: ExpectedPackageWorkStatus
347361
[CollectionName.ExternalMessageQueue]: ExternalMessageQueueObj
362+
[CollectionName.Notifications]: DBNotificationObj
348363
[CollectionName.NrcsIngestDataCache]: NrcsIngestDataCacheObj
349364
[CollectionName.PartInstances]: DBPartInstance
350365
[CollectionName.PackageContainerStatuses]: PackageContainerStatusDB

packages/meteor-lib/src/api/pubsub.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import {
22
BucketId,
33
OrganizationId,
44
PartId,
5-
RundownId,
65
RundownPlaylistActivationId,
76
RundownPlaylistId,
87
ShowStyleBaseId,
@@ -33,7 +32,6 @@ import { CorelibPubSub, CorelibPubSubCollections, CorelibPubSubTypes } from '@so
3332
import { CollectionName } from '@sofie-automation/corelib/dist/dataModel/Collections'
3433
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
3534
import { PartInstance } from '../collections/PartInstances.js'
36-
import type { DBNotificationObj } from '@sofie-automation/corelib/dist/dataModel/Notifications'
3735

3836
/**
3937
* Ids of possible DDP subscriptions for the UI only
@@ -86,14 +84,6 @@ export enum MeteorPubSub {
8684
* Fetch all translation bundles
8785
*/
8886
translationsBundles = 'translationsBundles',
89-
/**
90-
* Fetch notifications for playlist
91-
*/
92-
notificationsForRundownPlaylist = 'notificationsForRundownPlaylist',
93-
/**
94-
* Fetch notifications for rundown
95-
*/
96-
notificationsForRundown = 'notificationsForRundown',
9787

9888
// custom publications:
9989

@@ -186,11 +176,6 @@ export interface MeteorPubSubTypes {
186176
) => CollectionName.RundownLayouts
187177
[MeteorPubSub.organization]: (organizationId: OrganizationId | null, token?: string) => CollectionName.Organizations
188178
[MeteorPubSub.translationsBundles]: (token?: string) => CollectionName.TranslationsBundles
189-
[MeteorPubSub.notificationsForRundown]: (studioId: StudioId, rundownId: RundownId) => CollectionName.Notifications
190-
[MeteorPubSub.notificationsForRundownPlaylist]: (
191-
studioId: StudioId,
192-
playlistId: RundownPlaylistId
193-
) => CollectionName.Notifications
194179

195180
// custom publications:
196181

@@ -258,7 +243,9 @@ export type MeteorPubSubCollections = {
258243
[CollectionName.Buckets]: Bucket
259244
[CollectionName.TranslationsBundles]: TranslationsBundle
260245
[CollectionName.ExpectedPlayoutItems]: ExpectedPlayoutItem
261-
[CollectionName.Notifications]: DBNotificationObj
246+
247+
[CollectionName.MediaWorkFlows]: MediaWorkFlow
248+
[CollectionName.MediaWorkFlowSteps]: MediaWorkFlowStep
262249
} & MeteorPubSubCustomCollections
263250

264251
export type MeteorPubSubCustomCollections = {

packages/webui/src/client/ui/RundownView/RundownViewSubscriptions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function useRundownViewSubscriptions(playlistId: RundownPlaylistId): bool
116116

117117
auxSubsReady.push(
118118
useSubscriptionIfEnabled(
119-
MeteorPubSub.notificationsForRundownPlaylist,
119+
CorelibPubSub.notificationsForRundownPlaylist,
120120
!!playlistId && !!playlistStudioId,
121121
playlistStudioId || protectString(''),
122122
playlistId
@@ -135,7 +135,7 @@ export function useRundownViewSubscriptions(playlistId: RundownPlaylistId): bool
135135
).fetch() as Pick<DBRundown, '_id' | 'studioId'>[]
136136

137137
for (const rundown of rundowns) {
138-
meteorSubscribe(MeteorPubSub.notificationsForRundown, rundown.studioId, rundown._id)
138+
meteorSubscribe(CorelibPubSub.notificationsForRundown, rundown.studioId, rundown._id)
139139
}
140140
}, [playlistId])
141141

0 commit comments

Comments
 (0)