Skip to content

Commit

Permalink
tags -> userTags
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelecerati committed Jan 29, 2024
1 parent 1eb8885 commit bd0e41d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
18 changes: 9 additions & 9 deletions packages/api/src/controllers/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,11 @@ async function validateStreamPlaybackPolicy(
}
}

async function validateTags(tags: object) {
let stringifiedTags = JSON.stringify(tags);
async function validateTags(userTags: object) {
let stringifiedTags = JSON.stringify(userTags);
if (stringifiedTags.length > 2048) {
throw new BadRequestError(
`tags object is too large. Max size is 2048 characters`
`userTags object is too large. Max size is 2048 characters`
);
}
}
Expand Down Expand Up @@ -1003,8 +1003,8 @@ app.post(
doc.multistream
);

if (doc.tags) {
await validateTags(doc.tags);
if (doc.userTags) {
await validateTags(doc.userTags);
}

await db.stream.create(doc);
Expand Down Expand Up @@ -1456,7 +1456,7 @@ app.patch(
suspended,
multistream,
playbackPolicy,
tags,
userTags,
creatorId,
profiles,
} = payload;
Expand Down Expand Up @@ -1495,9 +1495,9 @@ app.patch(
patch = { ...patch, playbackPolicy };
}

if (tags) {
await validateTags(tags);
patch = { ...patch, tags };
if (userTags) {
await validateTags(userTags);
patch = { ...patch, userTags };
}

// remove undefined fields to check below
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/schema/api-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ components:
example: test_stream
creatorId:
$ref: "#/components/schemas/creator-id"
tags:
userTags:
type: object
description: User input tags associated with the stream
additionalProperties:
Expand Down Expand Up @@ -470,8 +470,8 @@ components:
$ref: "#/components/schemas/stream/properties/record"
multistream:
$ref: "#/components/schemas/stream/properties/multistream"
tags:
$ref: "#/components/schemas/stream/properties/tags"
userTags:
$ref: "#/components/schemas/stream/properties/userTags"
deactivate-many-payload:
type: object
additionalProperties: false
Expand Down Expand Up @@ -523,8 +523,8 @@ components:
$ref: "#/components/schemas/playback-policy"
profiles:
$ref: "#/components/schemas/stream/properties/profiles"
tags:
$ref: "#/components/schemas/stream/properties/tags"
userTags:
$ref: "#/components/schemas/stream/properties/userTags"
target-add-payload:
type: object
additionalProperties: false
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/schema/db-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ components:
example: 66E2161C-7670-4D05-B71D-DA2D6979556F
lastSeen:
index: true
tags:
userTags:
type: object
isActive:
index: true
Expand Down

0 comments on commit bd0e41d

Please sign in to comment.