REFACTOR: Optimized Catagory IDs
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m19s
Build, Push and Deploy CMS / build-push-deploy (push) Successful in 2m19s
This commit is contained in:
+20
-11
@@ -2,9 +2,16 @@ package api
|
||||
|
||||
import "time"
|
||||
|
||||
// Category is one entry of the fixed category lookup table. Its ID is what
|
||||
// clients send back in CompleteRequest.CategoryIDs.
|
||||
type Category struct {
|
||||
ID int16 `json:"id" example:"1"`
|
||||
Name string `json:"name" example:"documentary"`
|
||||
}
|
||||
|
||||
// CategoriesResponse is the body of GET /api/categories.
|
||||
type CategoriesResponse struct {
|
||||
Categories []string `json:"categories" example:"documentary,news"`
|
||||
Categories []Category `json:"categories"`
|
||||
}
|
||||
|
||||
// PresignRequest is the body of POST /api/videos/presign.
|
||||
@@ -19,24 +26,26 @@ type PresignResponse struct {
|
||||
Key string `json:"key" example:"videos/a1b2c3d4e5f6.mov"`
|
||||
}
|
||||
|
||||
// CompleteRequest is the body of POST /api/videos.
|
||||
// CompleteRequest is the body of POST /api/videos. CategoryIDs holds ids from
|
||||
// GET /api/categories, not category names, and must carry at least one — a
|
||||
// video with no category is rejected.
|
||||
type CompleteRequest struct {
|
||||
Title string `json:"title" example:"Inside the Newsroom"`
|
||||
Description string `json:"description" example:"A behind-the-scenes look at the evening bulletin."`
|
||||
Categories []string `json:"categories" example:"documentary,news"`
|
||||
Tags string `json:"tags" example:"media, press, riyadh"`
|
||||
FileName string `json:"fileName" example:"interview-cut.mov"`
|
||||
Key string `json:"key" example:"videos/a1b2c3d4e5f6.mov"`
|
||||
Title string `json:"title" example:"Inside the Newsroom"`
|
||||
Description string `json:"description" example:"A behind-the-scenes look at the evening bulletin."`
|
||||
CategoryIDs []int16 `json:"categoryIds" example:"1,2"`
|
||||
Tags string `json:"tags" example:"media, press, riyadh"`
|
||||
FileName string `json:"fileName" example:"interview-cut.mov"`
|
||||
Key string `json:"key" example:"videos/a1b2c3d4e5f6.mov"`
|
||||
}
|
||||
|
||||
// VideoResponse is a persisted video record as returned by POST /api/videos.
|
||||
// CompleteResponse is a persisted video record as returned by POST /api/videos.
|
||||
// Status carries the values of services.VideoStatus; the enums tag has to be
|
||||
// widened by hand whenever that type gains a state.
|
||||
type VideoResponse struct {
|
||||
type CompleteResponse struct {
|
||||
ID string `json:"id" example:"0199f3a1-7c2e-7b21-9f0d-1a2b3c4d5e6f"`
|
||||
Title string `json:"title" example:"Inside the Newsroom"`
|
||||
Description string `json:"description" example:"A behind-the-scenes look at the evening bulletin."`
|
||||
Categories []string `json:"categories" example:"documentary,news"`
|
||||
CategoryIDs []int16 `json:"categoryIds" example:"1,2"`
|
||||
Tags string `json:"tags" example:"media, press, riyadh"`
|
||||
FileName string `json:"fileName" example:"interview-cut.mov"`
|
||||
StorageKey string `json:"storageKey" example:"videos/a1b2c3d4e5f6.mov"`
|
||||
|
||||
Reference in New Issue
Block a user