Skip to content

Commit

Permalink
fix: change to nullable create/patch stream (#2179)
Browse files Browse the repository at this point in the history
* fix: change to nullable create/patch stream

* feat: added nullable to asset profiles field

* api: Handle null profiles appropriately

---------

Co-authored-by: Victor Elias <[email protected]>
  • Loading branch information
0xcadams and victorges authored May 15, 2024
1 parent f01c457 commit d1936e9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/api/src/controllers/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ const uploadWithUrlHandler: RequestHandler = async (req, res) => {
"vod-thumbs-off",
req.user?.id
)),
profiles,
...(profiles ? { profiles } : null), // avoid serializing null profiles on the task,
targetSegmentSizeSecs,
},
},
Expand Down Expand Up @@ -897,7 +897,7 @@ app.post(
let playbackId = await generateUniquePlaybackId(id);

const { vodObjectStoreId, jwtSecret, jwtAudience } = req.config;
const { encryption, c2pa } = req.body as NewAssetPayload;
const { encryption, c2pa, profiles } = req.body as NewAssetPayload;
if (encryption) {
if (encryption.encryptedKey) {
if (!isValidBase64(encryption.encryptedKey)) {
Expand Down Expand Up @@ -944,6 +944,7 @@ app.post(
catalystPipelineStrategy: catalystPipelineStrategy(req),
encryption,
c2pa,
...(profiles ? { profiles } : null), // avoid serializing null profiles on the task
},
},
null,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/controllers/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1358,8 +1358,8 @@ async function handleCreateStream(req: Request, payload: NewStreamPayload) {
}

let doc: DBStream = {
profiles: req.config.defaultStreamProfiles,
...payload,
profiles: payload.profiles || req.config.defaultStreamProfiles,
kind: "stream",
userId: req.user.id,
creatorId: mapInputCreatorId(payload.creatorId),
Expand Down
16 changes: 13 additions & 3 deletions packages/api/src/schema/api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,11 @@ components:
playbackPolicy:
$ref: "#/components/schemas/playback-policy"
profiles:
$ref: "#/components/schemas/stream/properties/profiles"
type:
- array
- "null"
items:
$ref: "#/components/schemas/ffmpeg-profile"
record:
$ref: "#/components/schemas/stream/properties/record"
multistream:
Expand Down Expand Up @@ -695,7 +699,11 @@ components:
playbackPolicy:
$ref: "#/components/schemas/playback-policy"
profiles:
$ref: "#/components/schemas/stream/properties/profiles"
type:
- array
- "null"
items:
$ref: "#/components/schemas/ffmpeg-profile"
userTags:
$ref: "#/components/schemas/stream/properties/userTags"
target-add-payload:
Expand Down Expand Up @@ -1306,7 +1314,9 @@ components:
type: boolean
description: Decides if the output video should include C2PA signature
profiles:
type: array
type:
- array
- "null"
items:
$ref: "#/components/schemas/transcode-profile"
targetSegmentSizeSecs:
Expand Down

0 comments on commit d1936e9

Please sign in to comment.