FEAT: Change Catagories to a list
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m17s
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m17s
This commit is contained in:
@@ -66,12 +66,12 @@ func PresignVideoUpload(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
type completeRequest struct {
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Category string `json:"category"`
|
||||
Tags string `json:"tags"`
|
||||
FileName string `json:"fileName"`
|
||||
Key string `json:"key"`
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Categories []string `json:"categories"`
|
||||
Tags string `json:"tags"`
|
||||
FileName string `json:"fileName"`
|
||||
Key string `json:"key"`
|
||||
}
|
||||
|
||||
func CompleteVideoUpload(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -95,6 +95,13 @@ func CompleteVideoUpload(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
categories := make([]string, 0, len(req.Categories))
|
||||
for _, category := range req.Categories {
|
||||
if category = strings.TrimSpace(category); category != "" {
|
||||
categories = append(categories, category)
|
||||
}
|
||||
}
|
||||
|
||||
jobID, err := services.MediaConvertClient.QueueEncodingJob(r.Context(), key)
|
||||
if err != nil {
|
||||
log.Printf("Something Went Wrong On Creation Of Transcoding Job: %s", err)
|
||||
@@ -105,7 +112,7 @@ func CompleteVideoUpload(w http.ResponseWriter, r *http.Request) {
|
||||
_, err = services.DB.CreateVideo(r.Context(), services.Video{
|
||||
Title: title,
|
||||
Description: strings.TrimSpace(req.Description),
|
||||
Category: strings.TrimSpace(req.Category),
|
||||
Categories: categories,
|
||||
Tags: strings.TrimSpace(req.Tags),
|
||||
FileName: strings.TrimSpace(req.FileName),
|
||||
StorageKey: key,
|
||||
@@ -122,7 +129,7 @@ func CompleteVideoUpload(w http.ResponseWriter, r *http.Request) {
|
||||
views.VideoUploadSuccess(views.VideoMetadata{
|
||||
Title: title,
|
||||
Description: strings.TrimSpace(req.Description),
|
||||
Category: strings.TrimSpace(req.Category),
|
||||
Categories: categories,
|
||||
Tags: strings.TrimSpace(req.Tags),
|
||||
FileName: strings.TrimSpace(req.FileName),
|
||||
JobID: jobID,
|
||||
|
||||
Reference in New Issue
Block a user