FEAT: Added MOre Video Statuses
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 2m2s

This commit is contained in:
FahdShalhoub
2026-08-17 00:13:22 +03:00
parent 4b719f712d
commit aa32bb6ed8
10 changed files with 216 additions and 146 deletions
+26 -21
View File
@@ -29,13 +29,13 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.categoriesResponse"
"$ref": "#/definitions/api.CategoriesResponse"
}
},
"500": {
"description": "Categories could not be read from the database",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -43,7 +43,7 @@ const docTemplate = `{
},
"/api/videos": {
"post": {
"description": "Step 2 of the upload flow. Takes the storage key returned by POST /api/videos/presign — after the file has been PUT to the presigned URL — submits a MediaConvert transcoding job, and persists the video with its category links. The returned record has status \"processing\"; note that nothing currently updates that status once transcoding finishes.",
"description": "Step 2 of the upload flow. Takes the storage key returned by POST /api/videos/presign — after the file has been PUT to the presigned URL — submits a MediaConvert transcoding job, and persists the video with its category links. The returned record has status \"processing\" — one of the states \"processing\", \"ready\" or \"failed\" — though nothing currently moves it on once transcoding finishes.",
"consumes": [
"application/json"
],
@@ -61,7 +61,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.completeRequest"
"$ref": "#/definitions/api.CompleteRequest"
}
}
],
@@ -69,25 +69,25 @@ const docTemplate = `{
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handlers.videoResponse"
"$ref": "#/definitions/api.VideoResponse"
}
},
"400": {
"description": "Request body was not valid JSON",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"422": {
"description": "title was empty, or key was missing or not a key issued by this API",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Transcoding job could not be queued, or the video record could not be saved",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -113,7 +113,7 @@ const docTemplate = `{
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.presignRequest"
"$ref": "#/definitions/api.PresignRequest"
}
}
],
@@ -121,25 +121,25 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.presignResponse"
"$ref": "#/definitions/api.PresignResponse"
}
},
"400": {
"description": "Request body was not valid JSON",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"422": {
"description": "contentType was not 'video/mp4' or 'video/quicktime'",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Upload URL could not be issued",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -159,7 +159,7 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.healthResponse"
"$ref": "#/definitions/api.HealthResponse"
}
}
}
@@ -167,7 +167,7 @@ const docTemplate = `{
}
},
"definitions": {
"handlers.categoriesResponse": {
"api.CategoriesResponse": {
"type": "object",
"properties": {
"categories": {
@@ -182,7 +182,7 @@ const docTemplate = `{
}
}
},
"handlers.completeRequest": {
"api.CompleteRequest": {
"type": "object",
"properties": {
"categories": {
@@ -217,7 +217,7 @@ const docTemplate = `{
}
}
},
"handlers.healthResponse": {
"api.HealthResponse": {
"type": "object",
"properties": {
"status": {
@@ -226,7 +226,7 @@ const docTemplate = `{
}
}
},
"handlers.presignRequest": {
"api.PresignRequest": {
"type": "object",
"properties": {
"contentType": {
@@ -243,7 +243,7 @@ const docTemplate = `{
}
}
},
"handlers.presignResponse": {
"api.PresignResponse": {
"type": "object",
"properties": {
"key": {
@@ -256,7 +256,7 @@ const docTemplate = `{
}
}
},
"handlers.problemDetails": {
"api.ProblemDetails": {
"type": "object",
"properties": {
"detail": {
@@ -277,7 +277,7 @@ const docTemplate = `{
}
}
},
"handlers.videoResponse": {
"api.VideoResponse": {
"type": "object",
"properties": {
"categories": {
@@ -315,6 +315,11 @@ const docTemplate = `{
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
+26 -21
View File
@@ -22,13 +22,13 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.categoriesResponse"
"$ref": "#/definitions/api.CategoriesResponse"
}
},
"500": {
"description": "Categories could not be read from the database",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -36,7 +36,7 @@
},
"/api/videos": {
"post": {
"description": "Step 2 of the upload flow. Takes the storage key returned by POST /api/videos/presign — after the file has been PUT to the presigned URL — submits a MediaConvert transcoding job, and persists the video with its category links. The returned record has status \"processing\"; note that nothing currently updates that status once transcoding finishes.",
"description": "Step 2 of the upload flow. Takes the storage key returned by POST /api/videos/presign — after the file has been PUT to the presigned URL — submits a MediaConvert transcoding job, and persists the video with its category links. The returned record has status \"processing\" — one of the states \"processing\", \"ready\" or \"failed\" — though nothing currently moves it on once transcoding finishes.",
"consumes": [
"application/json"
],
@@ -54,7 +54,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.completeRequest"
"$ref": "#/definitions/api.CompleteRequest"
}
}
],
@@ -62,25 +62,25 @@
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/handlers.videoResponse"
"$ref": "#/definitions/api.VideoResponse"
}
},
"400": {
"description": "Request body was not valid JSON",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"422": {
"description": "title was empty, or key was missing or not a key issued by this API",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Transcoding job could not be queued, or the video record could not be saved",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -106,7 +106,7 @@
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.presignRequest"
"$ref": "#/definitions/api.PresignRequest"
}
}
],
@@ -114,25 +114,25 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.presignResponse"
"$ref": "#/definitions/api.PresignResponse"
}
},
"400": {
"description": "Request body was not valid JSON",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"422": {
"description": "contentType was not 'video/mp4' or 'video/quicktime'",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
},
"500": {
"description": "Upload URL could not be issued",
"schema": {
"$ref": "#/definitions/handlers.problemDetails"
"$ref": "#/definitions/api.ProblemDetails"
}
}
}
@@ -152,7 +152,7 @@
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.healthResponse"
"$ref": "#/definitions/api.HealthResponse"
}
}
}
@@ -160,7 +160,7 @@
}
},
"definitions": {
"handlers.categoriesResponse": {
"api.CategoriesResponse": {
"type": "object",
"properties": {
"categories": {
@@ -175,7 +175,7 @@
}
}
},
"handlers.completeRequest": {
"api.CompleteRequest": {
"type": "object",
"properties": {
"categories": {
@@ -210,7 +210,7 @@
}
}
},
"handlers.healthResponse": {
"api.HealthResponse": {
"type": "object",
"properties": {
"status": {
@@ -219,7 +219,7 @@
}
}
},
"handlers.presignRequest": {
"api.PresignRequest": {
"type": "object",
"properties": {
"contentType": {
@@ -236,7 +236,7 @@
}
}
},
"handlers.presignResponse": {
"api.PresignResponse": {
"type": "object",
"properties": {
"key": {
@@ -249,7 +249,7 @@
}
}
},
"handlers.problemDetails": {
"api.ProblemDetails": {
"type": "object",
"properties": {
"detail": {
@@ -270,7 +270,7 @@
}
}
},
"handlers.videoResponse": {
"api.VideoResponse": {
"type": "object",
"properties": {
"categories": {
@@ -308,6 +308,11 @@
},
"status": {
"type": "string",
"enum": [
"processing",
"ready",
"failed"
],
"example": "processing"
},
"storageKey": {
+27 -22
View File
@@ -1,6 +1,6 @@
basePath: /
definitions:
handlers.categoriesResponse:
api.CategoriesResponse:
properties:
categories:
example:
@@ -10,7 +10,7 @@ definitions:
type: string
type: array
type: object
handlers.completeRequest:
api.CompleteRequest:
properties:
categories:
example:
@@ -35,13 +35,13 @@ definitions:
example: Inside the Newsroom
type: string
type: object
handlers.healthResponse:
api.HealthResponse:
properties:
status:
example: ok
type: string
type: object
handlers.presignRequest:
api.PresignRequest:
properties:
contentType:
enum:
@@ -53,7 +53,7 @@ definitions:
example: interview-cut.mov
type: string
type: object
handlers.presignResponse:
api.PresignResponse:
properties:
key:
example: videos/a1b2c3d4e5f6.mov
@@ -62,7 +62,7 @@ definitions:
example: https://raw-uploads-bucket.s3.amazonaws.com/videos/a1b2....mov?X-Amz-Signature=...
type: string
type: object
handlers.problemDetails:
api.ProblemDetails:
properties:
detail:
example: The 'title' field was absent or contained only whitespace. Every
@@ -78,7 +78,7 @@ definitions:
example: about:blank
type: string
type: object
handlers.videoResponse:
api.VideoResponse:
properties:
categories:
example:
@@ -105,6 +105,10 @@ definitions:
example: 60
type: integer
status:
enum:
- processing
- ready
- failed
example: processing
type: string
storageKey:
@@ -138,11 +142,11 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.categoriesResponse'
$ref: '#/definitions/api.CategoriesResponse'
"500":
description: Categories could not be read from the database
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
summary: List video categories
tags:
- categories
@@ -153,8 +157,9 @@ paths:
description: Step 2 of the upload flow. Takes the storage key returned by POST
/api/videos/presign — after the file has been PUT to the presigned URL — submits
a MediaConvert transcoding job, and persists the video with its category links.
The returned record has status "processing"; note that nothing currently updates
that status once transcoding finishes.
The returned record has status "processing" — one of the states "processing",
"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.
@@ -162,28 +167,28 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/handlers.completeRequest'
$ref: '#/definitions/api.CompleteRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/handlers.videoResponse'
$ref: '#/definitions/api.VideoResponse'
"400":
description: Request body was not valid JSON
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
"422":
description: title was empty, or key was missing or not a key issued by
this API
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
"500":
description: Transcoding job could not be queued, or the video record could
not be saved
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
summary: Register an uploaded video
tags:
- videos
@@ -204,26 +209,26 @@ paths:
name: request
required: true
schema:
$ref: '#/definitions/handlers.presignRequest'
$ref: '#/definitions/api.PresignRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.presignResponse'
$ref: '#/definitions/api.PresignResponse'
"400":
description: Request body was not valid JSON
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
"422":
description: contentType was not 'video/mp4' or 'video/quicktime'
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
"500":
description: Upload URL could not be issued
schema:
$ref: '#/definitions/handlers.problemDetails'
$ref: '#/definitions/api.ProblemDetails'
summary: Create a presigned upload URL
tags:
- videos
@@ -237,7 +242,7 @@ paths:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.healthResponse'
$ref: '#/definitions/api.HealthResponse'
summary: Health check
tags:
- system