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 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, 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, id) } // Flag order // // @Router /super/v1/orders/:id/flag [post] // @Summary Flag order // @Description Flag or unflag an order as problematic // @Tags Order // @Accept json // @Produce json // @Param id path int64 true "Order ID" // @Param form body dto.SuperOrderFlagForm true "Flag form" // @Success 200 {string} string "OK" // @Bind user local key(__ctx_user) // @Bind id path // @Bind form body func (c *orders) Flag(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperOrderFlagForm) error { return services.Super.FlagOrder(ctx, user.ID, id, form) } // Reconcile order // // @Router /super/v1/orders/:id/reconcile [post] // @Summary Reconcile order // @Description Mark or unmark order reconciliation status // @Tags Order // @Accept json // @Produce json // @Param id path int64 true "Order ID" // @Param form body dto.SuperOrderReconcileForm true "Reconcile form" // @Success 200 {string} string "OK" // @Bind user local key(__ctx_user) // @Bind id path // @Bind form body func (c *orders) Reconcile(ctx fiber.Ctx, user *models.User, id int64, form *dto.SuperOrderReconcileForm) error { return services.Super.ReconcileOrder(ctx, user.ID, id, form) } // 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, 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) }