- Deleted old super.go file and moved all related HTTP handlers to new package structure under backend/app/http/super/v1. - Updated service imports in super.go and super_test.go to reflect new DTO paths. - Created new auth, contents, orders, tenants, and users handlers with corresponding routes and methods. - Added new DTO definitions for authentication and content management in the super/v1/dto directory. - Implemented new migration for content_access table and created model for it.
48 lines
1.4 KiB
Go
48 lines
1.4 KiB
Go
package v1
|
|
|
|
import (
|
|
dto "quyun/v2/app/http/super/v1/dto"
|
|
"quyun/v2/app/requests"
|
|
"quyun/v2/app/services"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
// @provider
|
|
type contents struct{}
|
|
|
|
// List contents
|
|
//
|
|
// @Router /super/v1/contents [get]
|
|
// @Summary List contents
|
|
// @Description List contents
|
|
// @Tags Content
|
|
// @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.AdminContentItem}
|
|
// @Bind filter query
|
|
func (c *contents) List(ctx fiber.Ctx, filter *dto.SuperContentListFilter) (*requests.Pager, error) {
|
|
return services.Super.ListContents(ctx.Context(), filter)
|
|
}
|
|
|
|
// Update content status
|
|
//
|
|
// @Router /super/v1/tenants/:tenantID/contents/:contentID/status [patch]
|
|
// @Summary Update content status
|
|
// @Description Update content status
|
|
// @Tags Content
|
|
// @Accept json
|
|
// @Produce json
|
|
// @Param tenantID path int64 true "Tenant ID"
|
|
// @Param contentID path int64 true "Content ID"
|
|
// @Param form body dto.SuperTenantContentStatusUpdateForm true "Update form"
|
|
// @Success 200 {string} string "Updated"
|
|
// @Bind tenantID path
|
|
// @Bind contentID path
|
|
// @Bind form body
|
|
func (c *contents) UpdateStatus(ctx fiber.Ctx, tenantID, contentID int64, form *dto.SuperTenantContentStatusUpdateForm) error {
|
|
return services.Super.UpdateContentStatus(ctx.Context(), tenantID, contentID, form)
|
|
}
|