@@ -6,6 +6,9 @@ import { check, Match } from 'meteor/check'
66import { StudioId , BucketId , ShowStyleVariantId } from '@sofie-automation/corelib/dist/dataModel/Ids'
77import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'
88import { triggerWriteAccessBecauseNoCheckNecessary } from '../security/securityVerify'
9+ import { MongoQuery } from '@sofie-automation/corelib/dist/mongo'
10+ import { BucketAdLib } from '@sofie-automation/corelib/dist/dataModel/BucketAdLibPiece'
11+ import { BucketAdLibAction } from '@sofie-automation/corelib/dist/dataModel/BucketAdLibAction'
912
1013meteorPublish (
1114 CorelibPubSub . buckets ,
@@ -19,13 +22,12 @@ meteorPublish(
1922 fields : { } ,
2023 }
2124
22- return Buckets . findWithCursor (
23- {
24- _id : bucketId ?? undefined ,
25- studioId,
26- } ,
27- modifier
28- )
25+ const selector : MongoQuery < Bucket > = {
26+ studioId,
27+ }
28+ if ( bucketId ) selector . _id = bucketId
29+
30+ return Buckets . findWithCursor ( selector , modifier )
2931 }
3032)
3133
@@ -38,20 +40,19 @@ meteorPublish(
3840
3941 triggerWriteAccessBecauseNoCheckNecessary ( )
4042
41- return BucketAdLibs . findWithCursor (
42- {
43- studioId : studioId ,
44- bucketId : bucketId ?? undefined ,
45- showStyleVariantId : {
46- $in : [ null , ...showStyleVariantIds ] , // null = valid for all variants
47- } ,
43+ const selector : MongoQuery < BucketAdLib > = {
44+ studioId : studioId ,
45+ showStyleVariantId : {
46+ $in : [ null , ...showStyleVariantIds ] , // null = valid for all variants
4847 } ,
49- {
50- fields : {
51- ingestInfo : 0 , // This is a large blob, and is not of interest to the UI
52- } ,
53- }
54- )
48+ }
49+ if ( bucketId ) selector . bucketId = bucketId
50+
51+ return BucketAdLibs . findWithCursor ( selector , {
52+ fields : {
53+ ingestInfo : 0 , // This is a large blob, and is not of interest to the UI
54+ } ,
55+ } )
5556 }
5657)
5758
@@ -64,19 +65,18 @@ meteorPublish(
6465
6566 triggerWriteAccessBecauseNoCheckNecessary ( )
6667
67- return BucketAdLibActions . findWithCursor (
68- {
69- studioId : studioId ,
70- bucketId : bucketId ?? undefined ,
71- showStyleVariantId : {
72- $in : [ null , ...showStyleVariantIds ] , // null = valid for all variants
73- } ,
68+ const selector : MongoQuery < BucketAdLibAction > = {
69+ studioId : studioId ,
70+ showStyleVariantId : {
71+ $in : [ null , ...showStyleVariantIds ] , // null = valid for all variants
72+ } ,
73+ }
74+ if ( bucketId ) selector . bucketId = bucketId
75+
76+ return BucketAdLibActions . findWithCursor ( selector , {
77+ fields : {
78+ ingestInfo : 0 , // This is a large blob, and is not of interest to the UI
7479 } ,
75- {
76- fields : {
77- ingestInfo : 0 , // This is a large blob, and is not of interest to the UI
78- } ,
79- }
80- )
80+ } )
8181 }
8282)
0 commit comments