FEAT: Added MOre Video Statuses
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 2m2s
Build, Push and Deploy CMS / build-push-deploy (push) Failing after 2m2s
This commit is contained in:
@@ -20,7 +20,7 @@ type Video struct {
|
||||
FileName string
|
||||
StorageKey string
|
||||
MediaConvertJobID string
|
||||
Status string
|
||||
Status VideoStatus
|
||||
SizeBytes int64
|
||||
CreatedAt time.Time
|
||||
UpdatedAt time.Time
|
||||
@@ -56,7 +56,7 @@ func (svc DBConcrete) CreateVideo(ctx context.Context, v Video) (Video, error) {
|
||||
INSERT INTO videos (title, description, tags, file_name, storage_key, mediaconvert_job_id, status, size_bytes)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
||||
RETURNING id, created_at, updated_at
|
||||
`, v.Title, v.Description, v.Tags, v.FileName, v.StorageKey, v.MediaConvertJobID, v.Status, v.SizeBytes)
|
||||
`, v.Title, v.Description, v.Tags, v.FileName, v.StorageKey, v.MediaConvertJobID, string(v.Status), v.SizeBytes)
|
||||
|
||||
if err := row.Scan(&v.ID, &v.CreatedAt, &v.UpdatedAt); err != nil {
|
||||
return Video{}, err
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package services
|
||||
|
||||
// VideoStatus is the transcoding lifecycle state of a video, stored verbatim
|
||||
// in videos.status. The set is closed on both sides: the database rejects
|
||||
// anything outside it via the videos_status_check constraint. Adding a state
|
||||
// means adding a constant here, widening that constraint in a new migration,
|
||||
// and extending the `enums` annotation on api.VideoResponse.Status.
|
||||
type VideoStatus string
|
||||
|
||||
const (
|
||||
// VideoStatusProcessing is set when the MediaConvert job is queued. Every
|
||||
// video starts here, and nothing moves it on yet — see Known gaps.
|
||||
VideoStatusProcessing VideoStatus = "processing"
|
||||
// VideoStatusReady means transcoding finished and the output is in the
|
||||
// encoded bucket, reachable through CloudFront.
|
||||
VideoStatusReady VideoStatus = "ready"
|
||||
// VideoStatusFailed means the MediaConvert job ended in an error.
|
||||
VideoStatusFailed VideoStatus = "failed"
|
||||
)
|
||||
|
||||
func (s VideoStatus) String() string {
|
||||
return string(s)
|
||||
}
|
||||
Reference in New Issue
Block a user