feat: 添加获取全局选项接口,支持动态状态和曲种选择
This commit is contained in:
@@ -39,3 +39,16 @@ func (c *Common) Upload(
|
||||
}
|
||||
return services.Common.Upload(ctx.Context(), user.ID, file, val)
|
||||
}
|
||||
|
||||
// Get options (enums)
|
||||
//
|
||||
// @Router /v1/common/options [get]
|
||||
// @Summary Get options
|
||||
// @Description Get global options (enums)
|
||||
// @Tags Common
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.OptionsResponse
|
||||
func (c *Common) GetOptions(ctx fiber.Ctx) (*dto.OptionsResponse, error) {
|
||||
return services.Common.Options(ctx.Context())
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package dto
|
||||
|
||||
import "quyun/v2/app/requests"
|
||||
|
||||
type UploadResult struct {
|
||||
ID string `json:"id"`
|
||||
URL string `json:"url"`
|
||||
@@ -7,3 +9,8 @@ type UploadResult struct {
|
||||
Size int64 `json:"size"`
|
||||
MimeType string `json:"mime_type"`
|
||||
}
|
||||
|
||||
type OptionsResponse struct {
|
||||
ContentStatus []requests.KV `json:"content_status"`
|
||||
ContentGenre []requests.KV `json:"content_genre"`
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ func (r *Routes) Name() string {
|
||||
// Each route is registered with its corresponding controller action and parameter bindings.
|
||||
func (r *Routes) Register(router fiber.Router) {
|
||||
// Register routes for controller: Common
|
||||
r.log.Debugf("Registering route: Get /v1/common/options -> common.GetOptions")
|
||||
router.Get("/v1/common/options"[len(r.Path()):], DataFunc0(
|
||||
r.common.GetOptions,
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/upload -> common.Upload")
|
||||
router.Post("/v1/upload"[len(r.Path()):], DataFunc3(
|
||||
r.common.Upload,
|
||||
|
||||
Reference in New Issue
Block a user