@@ -6,6 +6,9 @@ import { check, Match } from 'meteor/check'
6
6
import { StudioId , BucketId , ShowStyleVariantId } from '@sofie-automation/corelib/dist/dataModel/Ids'
7
7
import { CorelibPubSub } from '@sofie-automation/corelib/dist/pubsub'
8
8
import { 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'
9
12
10
13
meteorPublish (
11
14
CorelibPubSub . buckets ,
@@ -19,13 +22,12 @@ meteorPublish(
19
22
fields : { } ,
20
23
}
21
24
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 )
29
31
}
30
32
)
31
33
@@ -38,20 +40,19 @@ meteorPublish(
38
40
39
41
triggerWriteAccessBecauseNoCheckNecessary ( )
40
42
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
48
47
} ,
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
+ } )
55
56
}
56
57
)
57
58
@@ -64,19 +65,18 @@ meteorPublish(
64
65
65
66
triggerWriteAccessBecauseNoCheckNecessary ( )
66
67
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
74
79
} ,
75
- {
76
- fields : {
77
- ingestInfo : 0 , // This is a large blob, and is not of interest to the UI
78
- } ,
79
- }
80
- )
80
+ } )
81
81
}
82
82
)
0 commit comments