64 lines
2.0 KiB
Go
64 lines
2.0 KiB
Go
package v1
|
|
|
|
import (
|
|
dto "quyun/v2/app/http/super/v1/dto"
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/app/services"
|
|
"quyun/v2/database/models"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type systemConfigs struct{}
|
|
|
|
// List system configs
|
|
//
|
|
// @Router /super/v1/system-configs [get]
|
|
// @Summary List system configs
|
|
// @Description List platform system configs
|
|
// @Tags SystemConfig
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param page query int false "Page number"
|
|
// @Param limit query int false "Page size"
|
|
// @Success 200 {object} requests.Pager{items=[]dto.SuperSystemConfigItem}
|
|
// @Bind filter query
|
|
func (c *systemConfigs) List(ctx fiber.Ctx, filter *dto.SuperSystemConfigListFilter) (*requests.Pager, error) {
|
|
return services.Super.ListSystemConfigs(ctx, filter)
|
|
}
|
|
|
|
// Create system config
|
|
//
|
|
// @Router /super/v1/system-configs [post]
|
|
// @Summary Create system config
|
|
// @Description Create platform system config
|
|
// @Tags SystemConfig
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param form body dto.SuperSystemConfigCreateForm true "Create form"
|
|
// @Success 200 {object} dto.SuperSystemConfigItem
|
|
// @Bind user local key(__ctx_user)
|
|
// @Bind form body
|
|
func (c *systemConfigs) Create(ctx fiber.Ctx, user *models.User, form *dto.SuperSystemConfigCreateForm) (*dto.SuperSystemConfigItem, error) {
|
|
return services.Super.CreateSystemConfig(ctx, user.ID, form)
|
|
}
|
|
|
|
// Update system config
|
|
//
|
|
// @Router /super/v1/system-configs/:id<int> [patch]
|
|
// @Summary Update system config
|
|
// @Description Update platform system config
|
|
// @Tags SystemConfig
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param id path int64 true "Config ID"
|
|
// @Param form body dto.SuperSystemConfigUpdateForm true "Update form"
|
|
// @Success 200 {object} dto.SuperSystemConfigItem
|
|
// @Bind user local key(__ctx_user)
|
|
// @Bind id path
|
|
// @Bind form body
|
|
func (c *systemConfigs) Update(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperSystemConfigUpdateForm) (*dto.SuperSystemConfigItem, error) {
|
|
return services.Super.UpdateSystemConfig(ctx, user.ID, id, form)
|
|
}
|