Skip to content

Commit e3fbb77

Browse files
committed
chore: add code documentation
1 parent 31c0693 commit e3fbb77

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,19 @@ class IngestServerAPI implements IngestRestAPI {
439439
return ClientAPI.responseSuccess(rundown)
440440
}
441441

442+
/**
443+
* Create a rundown through the REST ingest API.
444+
*
445+
* Note about playlist handling:
446+
*
447+
* Rundowns in Sofie are not owned by playlists. A playlist is merely a container
448+
* that may group multiple rundowns, and a rundown may move between playlists or
449+
* exist without an explicitly defined playlist.
450+
*
451+
* For this reason we intentionally do NOT include the playlistId when checking
452+
* if a rundown already exists. The `externalId` of a rundown is expected to be
453+
* unique within a studio, regardless of which playlist it belongs to.
454+
*/
442455
async postRundown(
443456
_connection: Meteor.Connection,
444457
_event: string,
@@ -455,6 +468,8 @@ class IngestServerAPI implements IngestRestAPI {
455468
this.validateRundown(ingestRundown)
456469
await this.validateAPIPayloadsForRundown(studio.blueprintId, ingestRundown)
457470

471+
// IMPORTANT: Do not scope rundown existence checks by playlistId.
472+
// Rundowns are unique per studio, not per playlist.
458473
const existingRundown = await Rundowns.findOneAsync({
459474
$or: [
460475
{

0 commit comments

Comments
 (0)