REFACTOR: Optimized Catagory IDs
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m19s

This commit is contained in:
FahdShalhoub
2026-08-17 00:51:11 +03:00
parent aa32bb6ed8
commit 56a2992206
9 changed files with 373 additions and 264 deletions
+86 -77
View File
@@ -17,7 +17,7 @@ const docTemplate = `{
"paths": {
"/api/categories": {
"get": {
"description": "Returns the fixed lookup set of categories a video can belong to. Values from this list are the only ones accepted in the ` + "`" + `categories` + "`" + ` field of POST /api/videos.",
"description": "Returns the fixed lookup set of categories a video can belong to, each with the id used to reference it. The ` + "`" + `id` + "`" + ` values from this list are the only ones accepted in the ` + "`" + `categoryIds` + "`" + ` field of POST /api/videos.",
"produces": [
"application/json"
],
@@ -56,7 +56,7 @@ const docTemplate = `{
"summary": "Register an uploaded video",
"parameters": [
{
"description": "Video metadata plus the storage key from the presign step. title and key are required; categories must be values from GET /api/categories.",
"description": "Video metadata plus the storage key from the presign step. title, key and categoryIds are required; categoryIds must hold at least one id from GET /api/categories.",
"name": "request",
"in": "body",
"required": true,
@@ -69,7 +69,7 @@ const docTemplate = `{
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.VideoResponse"
"$ref": "#/definitions/api.CompleteResponse"
}
},
"400": {
@@ -79,13 +79,13 @@ const docTemplate = `{
}
},
"422": {
"description": "title was empty, or key was missing or not a key issued by this API",
"description": "title was empty, key was missing or not a key issued by this API, or categoryIds was empty or contained an id that does not exist",
"schema": {
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Transcoding job could not be queued, or the video record could not be saved",
"description": "Categories could not be read, the transcoding job could not be queued, or the video record could not be saved",
"schema": {
"$ref": "#/definitions/api.ProblemDetails"
}
@@ -173,26 +173,35 @@ const docTemplate = `{
"categories": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"documentary",
"news"
]
"$ref": "#/definitions/api.Category"
}
}
}
},
"api.Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "documentary"
}
}
},
"api.CompleteRequest": {
"type": "object",
"properties": {
"categories": {
"categoryIds": {
"type": "array",
"items": {
"type": "string"
"type": "integer"
},
"example": [
"documentary",
"news"
1,
2
]
},
"description": {
@@ -217,6 +226,68 @@ const docTemplate = `{
}
}
},
"api.CompleteResponse": {
"type": "object",
"properties": {
"categoryIds": {
"type": "array",
"items": {
"type": "integer"
},
"example": [
1,
2
]
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string",
"example": "A behind-the-scenes look at the evening bulletin."
},
"fileName": {
"type": "string",
"example": "interview-cut.mov"
},
"id": {
"type": "string",
"example": "0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f"
},
"mediaConvertJobId": {
"type": "string",
"example": "1755300000000-abcdef"
},
"sizeBytes": {
"type": "integer",
"example": 60
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
"type": "string",
"example": "videos/a1b2c3d4e5f6.mov"
},
"tags": {
"type": "string",
"example": "media, press, riyadh"
},
"title": {
"type": "string",
"example": "Inside the Newsroom"
},
"updatedAt": {
"type": "string"
}
}
},
"api.HealthResponse": {
"type": "object",
"properties": {
@@ -276,68 +347,6 @@ const docTemplate = `{
"example": "about:blank"
}
}
},
"api.VideoResponse": {
"type": "object",
"properties": {
"categories": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"documentary",
"news"
]
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string",
"example": "A behind-the-scenes look at the evening bulletin."
},
"fileName": {
"type": "string",
"example": "interview-cut.mov"
},
"id": {
"type": "string",
"example": "0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f"
},
"mediaConvertJobId": {
"type": "string",
"example": "1755300000000-abcdef"
},
"sizeBytes": {
"type": "integer",
"example": 60
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
"type": "string",
"example": "videos/a1b2c3d4e5f6.mov"
},
"tags": {
"type": "string",
"example": "media, press, riyadh"
},
"title": {
"type": "string",
"example": "Inside the Newsroom"
},
"updatedAt": {
"type": "string"
}
}
}
}
}`
+86 -77
View File
@@ -10,7 +10,7 @@
"paths": {
"/api/categories": {
"get": {
"description": "Returns the fixed lookup set of categories a video can belong to. Values from this list are the only ones accepted in the `categories` field of POST /api/videos.",
"description": "Returns the fixed lookup set of categories a video can belong to, each with the id used to reference it. The `id` values from this list are the only ones accepted in the `categoryIds` field of POST /api/videos.",
"produces": [
"application/json"
],
@@ -49,7 +49,7 @@
"summary": "Register an uploaded video",
"parameters": [
{
"description": "Video metadata plus the storage key from the presign step. title and key are required; categories must be values from GET /api/categories.",
"description": "Video metadata plus the storage key from the presign step. title, key and categoryIds are required; categoryIds must hold at least one id from GET /api/categories.",
"name": "request",
"in": "body",
"required": true,
@@ -62,7 +62,7 @@
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.VideoResponse"
"$ref": "#/definitions/api.CompleteResponse"
}
},
"400": {
@@ -72,13 +72,13 @@
}
},
"422": {
"description": "title was empty, or key was missing or not a key issued by this API",
"description": "title was empty, key was missing or not a key issued by this API, or categoryIds was empty or contained an id that does not exist",
"schema": {
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Transcoding job could not be queued, or the video record could not be saved",
"description": "Categories could not be read, the transcoding job could not be queued, or the video record could not be saved",
"schema": {
"$ref": "#/definitions/api.ProblemDetails"
}
@@ -166,26 +166,35 @@
"categories": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"documentary",
"news"
]
"$ref": "#/definitions/api.Category"
}
}
}
},
"api.Category": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"name": {
"type": "string",
"example": "documentary"
}
}
},
"api.CompleteRequest": {
"type": "object",
"properties": {
"categories": {
"categoryIds": {
"type": "array",
"items": {
"type": "string"
"type": "integer"
},
"example": [
"documentary",
"news"
1,
2
]
},
"description": {
@@ -210,6 +219,68 @@
}
}
},
"api.CompleteResponse": {
"type": "object",
"properties": {
"categoryIds": {
"type": "array",
"items": {
"type": "integer"
},
"example": [
1,
2
]
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string",
"example": "A behind-the-scenes look at the evening bulletin."
},
"fileName": {
"type": "string",
"example": "interview-cut.mov"
},
"id": {
"type": "string",
"example": "0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f"
},
"mediaConvertJobId": {
"type": "string",
"example": "1755300000000-abcdef"
},
"sizeBytes": {
"type": "integer",
"example": 60
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
"type": "string",
"example": "videos/a1b2c3d4e5f6.mov"
},
"tags": {
"type": "string",
"example": "media, press, riyadh"
},
"title": {
"type": "string",
"example": "Inside the Newsroom"
},
"updatedAt": {
"type": "string"
}
}
},
"api.HealthResponse": {
"type": "object",
"properties": {
@@ -269,68 +340,6 @@
"example": "about:blank"
}
}
},
"api.VideoResponse": {
"type": "object",
"properties": {
"categories": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"documentary",
"news"
]
},
"createdAt": {
"type": "string"
},
"description": {
"type": "string",
"example": "A behind-the-scenes look at the evening bulletin."
},
"fileName": {
"type": "string",
"example": "interview-cut.mov"
},
"id": {
"type": "string",
"example": "0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f"
},
"mediaConvertJobId": {
"type": "string",
"example": "1755300000000-abcdef"
},
"sizeBytes": {
"type": "integer",
"example": 60
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
"type": "string",
"example": "videos/a1b2c3d4e5f6.mov"
},
"tags": {
"type": "string",
"example": "media, press, riyadh"
},
"title": {
"type": "string",
"example": "Inside the Newsroom"
},
"updatedAt": {
"type": "string"
}
}
}
}
}
+70 -63
View File
@@ -3,21 +3,27 @@ definitions:
api.CategoriesResponse:
properties:
categories:
example:
- documentary
- news
items:
type: string
$ref: '#/definitions/api.Category'
type: array
type: object
api.Category:
properties:
id:
example: 1
type: integer
name:
example: documentary
type: string
type: object
api.CompleteRequest:
properties:
categories:
categoryIds:
example:
- documentary
- news
- 1
- 2
items:
type: string
type: integer
type: array
description:
example: A behind-the-scenes look at the evening bulletin.
@@ -35,6 +41,51 @@ definitions:
example: Inside the Newsroom
type: string
type: object
api.CompleteResponse:
properties:
categoryIds:
example:
- 1
- 2
items:
type: integer
type: array
createdAt:
type: string
description:
example: A behind-the-scenes look at the evening bulletin.
type: string
fileName:
example: interview-cut.mov
type: string
id:
example: 0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f
type: string
mediaConvertJobId:
example: 1755300000000-abcdef
type: string
sizeBytes:
example: 60
type: integer
status:
enum:
- processing
- ready
- failed
example: processing
type: string
storageKey:
example: videos/a1b2c3d4e5f6.mov
type: string
tags:
example: media, press, riyadh
type: string
title:
example: Inside the Newsroom
type: string
updatedAt:
type: string
type: object
api.HealthResponse:
properties:
status:
@@ -78,51 +129,6 @@ definitions:
example: about:blank
type: string
type: object
api.VideoResponse:
properties:
categories:
example:
- documentary
- news
items:
type: string
type: array
createdAt:
type: string
description:
example: A behind-the-scenes look at the evening bulletin.
type: string
fileName:
example: interview-cut.mov
type: string
id:
example: 0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f
type: string
mediaConvertJobId:
example: 1755300000000-abcdef
type: string
sizeBytes:
example: 60
type: integer
status:
enum:
- processing
- ready
- failed
example: processing
type: string
storageKey:
example: videos/a1b2c3d4e5f6.mov
type: string
tags:
example: media, press, riyadh
type: string
title:
example: Inside the Newsroom
type: string
updatedAt:
type: string
type: object
info:
contact: {}
description: 'JSON API for ingesting videos into the Thamanyah catalogue. Uploads
@@ -133,9 +139,9 @@ info:
paths:
/api/categories:
get:
description: Returns the fixed lookup set of categories a video can belong to.
Values from this list are the only ones accepted in the `categories` field
of POST /api/videos.
description: Returns the fixed lookup set of categories a video can belong to,
each with the id used to reference it. The `id` values from this list are
the only ones accepted in the `categoryIds` field of POST /api/videos.
produces:
- application/json
responses:
@@ -161,8 +167,9 @@ paths:
"ready" or "failed" — though nothing currently moves it on once transcoding
finishes.
parameters:
- description: Video metadata plus the storage key from the presign step. title
and key are required; categories must be values from GET /api/categories.
- description: Video metadata plus the storage key from the presign step. title,
key and categoryIds are required; categoryIds must hold at least one id
from GET /api/categories.
in: body
name: request
required: true
@@ -174,19 +181,19 @@ paths:
"201":
description: Created
schema:
$ref: '#/definitions/api.VideoResponse'
$ref: '#/definitions/api.CompleteResponse'
"400":
description: Request body was not valid JSON
schema:
$ref: '#/definitions/api.ProblemDetails'
"422":
description: title was empty, or key was missing or not a key issued by
this API
description: title was empty, key was missing or not a key issued by this
API, or categoryIds was empty or contained an id that does not exist
schema:
$ref: '#/definitions/api.ProblemDetails'
"500":
description: Transcoding job could not be queued, or the video record could
not be saved
description: Categories could not be read, the transcoding job could not
be queued, or the video record could not be saved
schema:
$ref: '#/definitions/api.ProblemDetails'
summary: Register an uploaded video