@@ -456,11 +456,11 @@ class IngestServerAPI implements IngestRestAPI {
456456 _connection : Meteor . Connection ,
457457 _event : string ,
458458 studioId : StudioId ,
459- playlistId : string ,
459+ playlistId : string | undefined ,
460460 ingestRundown : RestApiIngestRundown
461461 ) : Promise < ClientAPI . ClientResponse < void > > {
462462 check ( studioId , String )
463- check ( playlistId , String )
463+ if ( playlistId !== undefined ) check ( playlistId , String )
464464 check ( ingestRundown , Object )
465465
466466 const studio = await this . findStudio ( studioId )
@@ -488,7 +488,8 @@ class IngestServerAPI implements IngestRestAPI {
488488
489489 await runIngestOperation ( studio . _id , IngestJobs . UpdateRundown , {
490490 rundownExternalId : ingestRundown . externalId ,
491- ingestRundown : { ...ingestRundown , playlistExternalId : playlistId } ,
491+ ingestRundown :
492+ playlistId !== undefined ? { ...ingestRundown , playlistExternalId : playlistId } : ingestRundown ,
492493 isCreateAction : true ,
493494 rundownSource : {
494495 type : 'restApi' ,
@@ -1249,6 +1250,26 @@ export function registerRoutes(registerRoute: APIRegisterHook<IngestRestAPI>): v
12491250 )
12501251
12511252 // Create rundown
1253+ registerRoute < { studioId : string } , never , void > (
1254+ 'post' ,
1255+ '/ingest/:studioId/rundowns' ,
1256+ new Map ( ) ,
1257+ ingestAPIFactory ,
1258+ async ( serverAPI , connection , event , params , body ) => {
1259+ logger . info ( `INGEST API POST: Rundowns (studio-scoped)` )
1260+
1261+ const studioId = protectString < StudioId > ( params . studioId )
1262+ check ( studioId , String )
1263+
1264+ const ingestRundown = body as RestApiIngestRundown
1265+ if ( ! ingestRundown ) throw new Meteor . Error ( 400 , 'Upload rundown: Missing request body' )
1266+ if ( typeof ingestRundown !== 'object' ) throw new Meteor . Error ( 400 , 'Upload rundown: Invalid request body' )
1267+
1268+ return await serverAPI . postRundown ( connection , event , studioId , undefined , ingestRundown )
1269+ }
1270+ )
1271+
1272+ // Create rundown in a playlist
12521273 registerRoute < { studioId : string ; playlistId : string ; rundownId : string } , never , void > (
12531274 'post' ,
12541275 '/ingest/:studioId/playlists/:playlistId/rundowns' ,
0 commit comments