Skip to content

Commit 3ff013d

Browse files
committed
Merge pull request #1466 from evs-broadcast/feat/playlist-external-id
feat: playlist external ID in REST API and Live Status Gateway
2 parents dbd9995 + 3bcf31b commit 3ff013d

File tree

8 files changed

+39
-7
lines changed

8 files changed

+39
-7
lines changed

meteor/server/api/rest/v1/playlists.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ class PlaylistsServerAPI implements PlaylistsRestAPI {
4141
async getAllRundownPlaylists(
4242
_connection: Meteor.Connection,
4343
_event: string
44-
): Promise<ClientAPI.ClientResponse<Array<{ id: string }>>> {
45-
const rundownPlaylists = (await RundownPlaylists.findFetchAsync({}, { projection: { _id: 1 } })) as Array<
46-
Pick<DBRundownPlaylist, '_id'>
47-
>
44+
): Promise<ClientAPI.ClientResponse<Array<{ id: string; externalId: string }>>> {
45+
const rundownPlaylists = (await RundownPlaylists.findFetchAsync(
46+
{},
47+
{ projection: { _id: 1, externalId: 1 } }
48+
)) as Array<Pick<DBRundownPlaylist, '_id' | 'externalId'>>
4849
return ClientAPI.responseSuccess(
49-
rundownPlaylists.map((rundownPlaylist) => ({ id: unprotectString(rundownPlaylist._id) }))
50+
rundownPlaylists.map((rundownPlaylist) => ({
51+
id: unprotectString(rundownPlaylist._id),
52+
externalId: rundownPlaylist.externalId,
53+
}))
5054
)
5155
}
5256

packages/live-status-gateway-api/api/schemas/activePlaylist.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ $defs:
1313
oneOf:
1414
- type: string
1515
- type: 'null'
16+
externalId:
17+
description: Id normally sourced from the ingest system
18+
oneOf:
19+
- type: string
20+
- type: 'null'
1621
name:
1722
description: User-presentable name for the active playlist
1823
type: string
@@ -77,11 +82,12 @@ $defs:
7782
description: The end of the loop
7883
$ref: '#/$defs/quickLoopMarker'
7984
required: [locked, running]
80-
required: [event, id, name, rundownIds, currentPart, currentSegment, nextPart, timing]
85+
required: [event, id, externalId, name, rundownIds, currentPart, currentSegment, nextPart, timing]
8186
additionalProperties: false
8287
examples:
8388
- event: activePlaylist
8489
id: 'OKAgZmZ0Buc99lE_2uPPSKVbMrQ_'
90+
externalId: '1ZIYVYL1aEkNEJbeGsmRXr5s8wtkyxfPRjNSTxZfcoEI'
8591
name: 'Playlist 0'
8692
rundownIds: ['y9HauyWkcxQS3XaAOsW40BRLLsI_']
8793
currentPart:

packages/live-status-gateway-api/api/schemas/studio.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ $defs:
3636
id:
3737
description: Unique id of the playlist
3838
type: string
39+
externalId:
40+
description: Id normally sourced from the ingest system
41+
type: string
3942
name:
4043
description: The user defined playlist name
4144
type: string
@@ -47,9 +50,10 @@ $defs:
4750
- deactivated
4851
- rehearsal
4952
- activated
50-
required: [id, name, activationStatus]
53+
required: [id, externalId, name, activationStatus]
5154
additionalProperties: false
5255
examples:
5356
- id: 'OKAgZmZ0Buc99lE_2uPPSKVbMrQ_'
57+
externalId: '1ZIYVYL1aEkNEJbeGsmRXr5s8wtkyxfPRjNSTxZfcoEI'
5458
name: 'Playlist 0'
5559
activationStatus: rehearsal

packages/live-status-gateway-api/src/generated/schema.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ interface PlaylistStatus {
102102
* Unique id of the playlist
103103
*/
104104
id: string
105+
/**
106+
* Id normally sourced from the ingest system
107+
*/
108+
externalId: string
105109
/**
106110
* The user defined playlist name
107111
*/
@@ -127,6 +131,10 @@ interface ActivePlaylistEvent {
127131
* Unique id of the active playlist
128132
*/
129133
id: string | null
134+
/**
135+
* Id normally sourced from the ingest system
136+
*/
137+
externalId: string | null
130138
/**
131139
* User-presentable name for the active playlist
132140
*/

packages/live-status-gateway/src/topics/__tests__/activePlaylist.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ describe('ActivePlaylistTopic', () => {
5353
event: 'activePlaylist',
5454
name: playlist.name,
5555
id: unprotectString(playlist._id),
56+
externalId: 'NCS_PLAYLIST_1',
5657
currentPart: null,
5758
nextPart: null,
5859
currentSegment: null,
@@ -129,6 +130,7 @@ describe('ActivePlaylistTopic', () => {
129130
event: 'activePlaylist',
130131
name: playlist.name,
131132
id: unprotectString(playlist._id),
133+
externalId: 'NCS_PLAYLIST_1',
132134
currentPart: {
133135
id: 'PART_1',
134136
name: 'Test Part',
@@ -232,6 +234,7 @@ describe('ActivePlaylistTopic', () => {
232234
event: 'activePlaylist',
233235
name: playlist.name,
234236
id: unprotectString(playlist._id),
237+
externalId: 'NCS_PLAYLIST_1',
235238
currentPart: {
236239
id: 'PART_1',
237240
name: 'Test Part',

packages/live-status-gateway/src/topics/activePlaylistTopic.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const THROTTLE_PERIOD_MS = 100
4040

4141
const PLAYLIST_KEYS = [
4242
'_id',
43+
'externalId',
4344
'activationId',
4445
'name',
4546
'rundownIdsInOrder',
@@ -103,6 +104,7 @@ export class ActivePlaylistTopic extends WebSocketTopicBase implements WebSocket
103104
? literal<ActivePlaylistEvent>({
104105
event: 'activePlaylist',
105106
id: unprotectString(this._activePlaylist._id),
107+
externalId: this._activePlaylist.externalId,
106108
name: this._activePlaylist.name,
107109
rundownIds: this._activePlaylist.rundownIdsInOrder.map((r) => unprotectString(r)),
108110
currentPart:
@@ -172,6 +174,7 @@ export class ActivePlaylistTopic extends WebSocketTopicBase implements WebSocket
172174
: literal<ActivePlaylistEvent>({
173175
event: 'activePlaylist',
174176
id: null,
177+
externalId: null,
175178
name: '',
176179
rundownIds: [],
177180
currentPart: null,

packages/live-status-gateway/src/topics/studioTopic.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class StudioTopic extends WebSocketTopicBase implements WebSocketTopic {
5656
if (p.activationId && p.rehearsal) activationStatus = PlaylistActivationStatus.REHEARSAL
5757
return literal<PlaylistStatus>({
5858
id: unprotectString(p._id),
59+
externalId: p.externalId,
5960
name: p.name,
6061
activationStatus: activationStatus,
6162
})

packages/openapi/api/definitions/playlists.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,11 @@ components:
722722
properties:
723723
id:
724724
type: string
725+
externalId:
726+
type: string
725727
required:
726728
- id
729+
- externalId
727730
additionalProperties: false
728731
responses:
729732
putSuccess:

0 commit comments

Comments
 (0)