Refactor super module: Move HTTP handlers to new super/v1 package
- 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.
This commit is contained in:
73
backend/app/http/super/v1/orders.go
Normal file
73
backend/app/http/super/v1/orders.go
Normal file
@@ -0,0 +1,73 @@
|
||||
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 orders struct{}
|
||||
|
||||
// List orders
|
||||
//
|
||||
// @Router /super/v1/orders [get]
|
||||
// @Summary List orders
|
||||
// @Description List orders
|
||||
// @Tags Order
|
||||
// @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.SuperOrderItem}
|
||||
// @Bind filter query
|
||||
func (c *orders) List(ctx fiber.Ctx, filter *dto.SuperOrderListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListOrders(ctx.Context(), filter)
|
||||
}
|
||||
|
||||
// Get order
|
||||
//
|
||||
// @Router /super/v1/orders/:id [get]
|
||||
// @Summary Get order
|
||||
// @Description Get order
|
||||
// @Tags Order
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Success 200 {object} dto.SuperOrderDetail
|
||||
// @Bind id path
|
||||
func (c *orders) Get(ctx fiber.Ctx, id int64) (*dto.SuperOrderDetail, error) {
|
||||
return services.Super.GetOrder(ctx.Context(), id)
|
||||
}
|
||||
|
||||
// Refund order
|
||||
//
|
||||
// @Router /super/v1/orders/:id/refund [post]
|
||||
// @Summary Refund order
|
||||
// @Description Refund order
|
||||
// @Tags Order
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Param id path int64 true "Order ID"
|
||||
// @Param form body dto.SuperOrderRefundForm true "Refund form"
|
||||
// @Success 200 {string} string "Refunded"
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *orders) Refund(ctx fiber.Ctx, id int64, form *dto.SuperOrderRefundForm) error {
|
||||
return services.Super.RefundOrder(ctx.Context(), id, form)
|
||||
}
|
||||
|
||||
// Order statistics
|
||||
//
|
||||
// @Router /super/v1/orders/statistics [get]
|
||||
// @Summary Order statistics
|
||||
// @Description Order statistics
|
||||
// @Tags Order
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.OrderStatisticsResponse
|
||||
func (c *orders) Statistics(ctx fiber.Ctx) (*dto.OrderStatisticsResponse, error) {
|
||||
return services.Super.OrderStatistics(ctx.Context())
|
||||
}
|
||||
Reference in New Issue
Block a user