Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
493 lines
22 KiB
Go
493 lines
22 KiB
Go
// Code generated by atomctl. DO NOT EDIT.
|
|
|
|
// Package v1 provides HTTP route definitions and registration
|
|
// for the quyun/v2 application.
|
|
package v1
|
|
|
|
import (
|
|
"mime/multipart"
|
|
"quyun/v2/app/http/v1/dto"
|
|
"quyun/v2/app/middlewares"
|
|
"quyun/v2/database/models"
|
|
|
|
"github.com/gofiber/fiber/v3"
|
|
log "github.com/sirupsen/logrus"
|
|
_ "go.ipao.vip/atom"
|
|
_ "go.ipao.vip/atom/contracts"
|
|
. "go.ipao.vip/atom/fen"
|
|
)
|
|
|
|
// Routes implements the HttpRoute contract and provides route registration
|
|
// for all controllers in the v1 module.
|
|
//
|
|
// @provider contracts.HttpRoute atom.GroupRoutes
|
|
type Routes struct {
|
|
log *log.Entry `inject:"false"`
|
|
middlewares *middlewares.Middlewares
|
|
// Controller instances
|
|
common *Common
|
|
content *Content
|
|
creator *Creator
|
|
storage *Storage
|
|
tenant *Tenant
|
|
transaction *Transaction
|
|
user *User
|
|
}
|
|
|
|
// Prepare initializes the routes provider with logging configuration.
|
|
func (r *Routes) Prepare() error {
|
|
r.log = log.WithField("module", "routes.v1")
|
|
r.log.Info("Initializing routes module")
|
|
return nil
|
|
}
|
|
|
|
// Name returns the unique identifier for this routes provider.
|
|
func (r *Routes) Name() string {
|
|
return "v1"
|
|
}
|
|
|
|
// Register registers all HTTP routes with the provided fiber router.
|
|
// 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: Delete /v1/t/:tenantCode/media-assets/:id<int> -> common.DeleteMediaAsset")
|
|
router.Delete("/v1/t/:tenantCode/media-assets/:id<int>"[len(r.Path()):], Func2(
|
|
r.common.DeleteMediaAsset,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/upload/:uploadId -> common.AbortUpload")
|
|
router.Delete("/v1/t/:tenantCode/upload/:uploadId"[len(r.Path()):], Func2(
|
|
r.common.AbortUpload,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[string]("uploadId"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/common/options -> common.GetOptions")
|
|
router.Get("/v1/t/:tenantCode/common/options"[len(r.Path()):], DataFunc0(
|
|
r.common.GetOptions,
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/upload/check -> common.CheckHash")
|
|
router.Get("/v1/t/:tenantCode/upload/check"[len(r.Path()):], DataFunc2(
|
|
r.common.CheckHash,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[string]("hash"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/upload -> common.Upload")
|
|
router.Post("/v1/t/:tenantCode/upload"[len(r.Path()):], DataFunc3(
|
|
r.common.Upload,
|
|
Local[*models.User]("__ctx_user"),
|
|
File[multipart.FileHeader]("file"),
|
|
Body[dto.UploadForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/upload/complete -> common.CompleteUpload")
|
|
router.Post("/v1/t/:tenantCode/upload/complete"[len(r.Path()):], DataFunc2(
|
|
r.common.CompleteUpload,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.UploadCompleteForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/upload/init -> common.InitUpload")
|
|
router.Post("/v1/t/:tenantCode/upload/init"[len(r.Path()):], DataFunc2(
|
|
r.common.InitUpload,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.UploadInitForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/upload/part -> common.UploadPart")
|
|
router.Post("/v1/t/:tenantCode/upload/part"[len(r.Path()):], Func3(
|
|
r.common.UploadPart,
|
|
Local[*models.User]("__ctx_user"),
|
|
File[multipart.FileHeader]("file"),
|
|
Body[dto.UploadPartForm]("form"),
|
|
))
|
|
// Register routes for controller: Content
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/contents/:id<int>/favorite -> content.RemoveFavorite")
|
|
router.Delete("/v1/t/:tenantCode/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
|
r.content.RemoveFavorite,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/contents/:id<int>/like -> content.RemoveLike")
|
|
router.Delete("/v1/t/:tenantCode/contents/:id<int>/like"[len(r.Path()):], Func1(
|
|
r.content.RemoveLike,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/contents -> content.List")
|
|
router.Get("/v1/t/:tenantCode/contents"[len(r.Path()):], DataFunc1(
|
|
r.content.List,
|
|
Query[dto.ContentListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/contents/:id<int> -> content.Get")
|
|
router.Get("/v1/t/:tenantCode/contents/:id<int>"[len(r.Path()):], DataFunc1(
|
|
r.content.Get,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/contents/:id<int>/comments -> content.ListComments")
|
|
router.Get("/v1/t/:tenantCode/contents/:id<int>/comments"[len(r.Path()):], DataFunc2(
|
|
r.content.ListComments,
|
|
PathParam[int64]("id"),
|
|
QueryParam[int]("page"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/topics -> content.ListTopics")
|
|
router.Get("/v1/t/:tenantCode/topics"[len(r.Path()):], DataFunc0(
|
|
r.content.ListTopics,
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/comments/:id<int>/like -> content.LikeComment")
|
|
router.Post("/v1/t/:tenantCode/comments/:id<int>/like"[len(r.Path()):], Func1(
|
|
r.content.LikeComment,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/contents/:id<int>/comments -> content.CreateComment")
|
|
router.Post("/v1/t/:tenantCode/contents/:id<int>/comments"[len(r.Path()):], Func2(
|
|
r.content.CreateComment,
|
|
PathParam[int64]("id"),
|
|
Body[dto.CommentCreateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/contents/:id<int>/favorite -> content.AddFavorite")
|
|
router.Post("/v1/t/:tenantCode/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
|
r.content.AddFavorite,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/contents/:id<int>/like -> content.AddLike")
|
|
router.Post("/v1/t/:tenantCode/contents/:id<int>/like"[len(r.Path()):], Func1(
|
|
r.content.AddLike,
|
|
PathParam[int64]("id"),
|
|
))
|
|
// Register routes for controller: Creator
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/creator/contents/:id<int> -> creator.DeleteContent")
|
|
router.Delete("/v1/t/:tenantCode/creator/contents/:id<int>"[len(r.Path()):], Func1(
|
|
r.creator.DeleteContent,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/creator/members/:id<int> -> creator.RemoveMember")
|
|
router.Delete("/v1/t/:tenantCode/creator/members/:id<int>"[len(r.Path()):], Func1(
|
|
r.creator.RemoveMember,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/creator/members/invites/:id<int> -> creator.DisableMemberInvite")
|
|
router.Delete("/v1/t/:tenantCode/creator/members/invites/:id<int>"[len(r.Path()):], Func1(
|
|
r.creator.DisableMemberInvite,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/creator/payout-accounts -> creator.RemovePayoutAccount")
|
|
router.Delete("/v1/t/:tenantCode/creator/payout-accounts"[len(r.Path()):], Func1(
|
|
r.creator.RemovePayoutAccount,
|
|
QueryParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/contents -> creator.ListContents")
|
|
router.Get("/v1/t/:tenantCode/creator/contents"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListContents,
|
|
Query[dto.CreatorContentListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/contents/:id<int> -> creator.GetContent")
|
|
router.Get("/v1/t/:tenantCode/creator/contents/:id<int>"[len(r.Path()):], DataFunc1(
|
|
r.creator.GetContent,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/coupons -> creator.ListCoupons")
|
|
router.Get("/v1/t/:tenantCode/creator/coupons"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListCoupons,
|
|
Query[dto.CouponListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/coupons/:id<int> -> creator.GetCoupon")
|
|
router.Get("/v1/t/:tenantCode/creator/coupons/:id<int>"[len(r.Path()):], DataFunc1(
|
|
r.creator.GetCoupon,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/dashboard -> creator.Dashboard")
|
|
router.Get("/v1/t/:tenantCode/creator/dashboard"[len(r.Path()):], DataFunc0(
|
|
r.creator.Dashboard,
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/members -> creator.ListMembers")
|
|
router.Get("/v1/t/:tenantCode/creator/members"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListMembers,
|
|
Query[dto.TenantMemberListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/members/invites -> creator.ListMemberInvites")
|
|
router.Get("/v1/t/:tenantCode/creator/members/invites"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListMemberInvites,
|
|
Query[dto.TenantInviteListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/members/join-requests -> creator.ListMemberJoinRequests")
|
|
router.Get("/v1/t/:tenantCode/creator/members/join-requests"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListMemberJoinRequests,
|
|
Query[dto.TenantJoinRequestListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/orders -> creator.ListOrders")
|
|
router.Get("/v1/t/:tenantCode/creator/orders"[len(r.Path()):], DataFunc1(
|
|
r.creator.ListOrders,
|
|
Query[dto.CreatorOrderListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/payout-accounts -> creator.ListPayoutAccounts")
|
|
router.Get("/v1/t/:tenantCode/creator/payout-accounts"[len(r.Path()):], DataFunc0(
|
|
r.creator.ListPayoutAccounts,
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/reports/overview -> creator.ReportOverview")
|
|
router.Get("/v1/t/:tenantCode/creator/reports/overview"[len(r.Path()):], DataFunc1(
|
|
r.creator.ReportOverview,
|
|
Query[dto.ReportOverviewFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/creator/settings -> creator.GetSettings")
|
|
router.Get("/v1/t/:tenantCode/creator/settings"[len(r.Path()):], DataFunc0(
|
|
r.creator.GetSettings,
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/apply -> creator.Apply")
|
|
router.Post("/v1/t/:tenantCode/creator/apply"[len(r.Path()):], Func1(
|
|
r.creator.Apply,
|
|
Body[dto.ApplyForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/contents -> creator.CreateContent")
|
|
router.Post("/v1/t/:tenantCode/creator/contents"[len(r.Path()):], Func1(
|
|
r.creator.CreateContent,
|
|
Body[dto.ContentCreateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/coupons -> creator.CreateCoupon")
|
|
router.Post("/v1/t/:tenantCode/creator/coupons"[len(r.Path()):], DataFunc1(
|
|
r.creator.CreateCoupon,
|
|
Body[dto.CouponCreateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/coupons/:id<int>/grant -> creator.GrantCoupon")
|
|
router.Post("/v1/t/:tenantCode/creator/coupons/:id<int>/grant"[len(r.Path()):], DataFunc2(
|
|
r.creator.GrantCoupon,
|
|
PathParam[int64]("id"),
|
|
Body[dto.CouponGrantForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/members/:id<int>/review -> creator.ReviewMemberJoinRequest")
|
|
router.Post("/v1/t/:tenantCode/creator/members/:id<int>/review"[len(r.Path()):], Func2(
|
|
r.creator.ReviewMemberJoinRequest,
|
|
PathParam[int64]("id"),
|
|
Body[dto.TenantJoinReviewForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/members/invite -> creator.CreateMemberInvite")
|
|
router.Post("/v1/t/:tenantCode/creator/members/invite"[len(r.Path()):], DataFunc1(
|
|
r.creator.CreateMemberInvite,
|
|
Body[dto.TenantInviteCreateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/orders/:id<int>/refund -> creator.RefundOrder")
|
|
router.Post("/v1/t/:tenantCode/creator/orders/:id<int>/refund"[len(r.Path()):], Func2(
|
|
r.creator.RefundOrder,
|
|
PathParam[int64]("id"),
|
|
Body[dto.RefundForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/payout-accounts -> creator.AddPayoutAccount")
|
|
router.Post("/v1/t/:tenantCode/creator/payout-accounts"[len(r.Path()):], Func1(
|
|
r.creator.AddPayoutAccount,
|
|
Body[dto.PayoutAccount]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/reports/export -> creator.ExportReport")
|
|
router.Post("/v1/t/:tenantCode/creator/reports/export"[len(r.Path()):], DataFunc1(
|
|
r.creator.ExportReport,
|
|
Body[dto.ReportExportForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/creator/withdraw -> creator.Withdraw")
|
|
router.Post("/v1/t/:tenantCode/creator/withdraw"[len(r.Path()):], Func1(
|
|
r.creator.Withdraw,
|
|
Body[dto.WithdrawForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Put /v1/t/:tenantCode/creator/contents/:id<int> -> creator.UpdateContent")
|
|
router.Put("/v1/t/:tenantCode/creator/contents/:id<int>"[len(r.Path()):], Func2(
|
|
r.creator.UpdateContent,
|
|
PathParam[int64]("id"),
|
|
Body[dto.ContentUpdateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Put /v1/t/:tenantCode/creator/coupons/:id<int> -> creator.UpdateCoupon")
|
|
router.Put("/v1/t/:tenantCode/creator/coupons/:id<int>"[len(r.Path()):], DataFunc2(
|
|
r.creator.UpdateCoupon,
|
|
PathParam[int64]("id"),
|
|
Body[dto.CouponUpdateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Put /v1/t/:tenantCode/creator/settings -> creator.UpdateSettings")
|
|
router.Put("/v1/t/:tenantCode/creator/settings"[len(r.Path()):], Func1(
|
|
r.creator.UpdateSettings,
|
|
Body[dto.Settings]("form"),
|
|
))
|
|
// Register routes for controller: Storage
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/storage/* -> storage.Download")
|
|
router.Get("/v1/t/:tenantCode/storage/*"[len(r.Path()):], Func2(
|
|
r.storage.Download,
|
|
QueryParam[string]("expires"),
|
|
QueryParam[string]("sign"),
|
|
))
|
|
r.log.Debugf("Registering route: Put /v1/t/:tenantCode/storage/* -> storage.Upload")
|
|
router.Put("/v1/t/:tenantCode/storage/*"[len(r.Path()):], DataFunc2(
|
|
r.storage.Upload,
|
|
QueryParam[string]("expires"),
|
|
QueryParam[string]("sign"),
|
|
))
|
|
// Register routes for controller: Tenant
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/tenants/:id<int>/follow -> tenant.Unfollow")
|
|
router.Delete("/v1/t/:tenantCode/tenants/:id<int>/follow"[len(r.Path()):], Func1(
|
|
r.tenant.Unfollow,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/tenants/:id<int>/join -> tenant.CancelJoin")
|
|
router.Delete("/v1/t/:tenantCode/tenants/:id<int>/join"[len(r.Path()):], Func1(
|
|
r.tenant.CancelJoin,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/tenants -> tenant.List")
|
|
router.Get("/v1/t/:tenantCode/tenants"[len(r.Path()):], DataFunc1(
|
|
r.tenant.List,
|
|
Query[dto.TenantListFilter]("filter"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/tenants/:id<int> -> tenant.Get")
|
|
router.Get("/v1/t/:tenantCode/tenants/:id<int>"[len(r.Path()):], DataFunc1(
|
|
r.tenant.Get,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/tenants/:id<int>/follow -> tenant.Follow")
|
|
router.Post("/v1/t/:tenantCode/tenants/:id<int>/follow"[len(r.Path()):], Func1(
|
|
r.tenant.Follow,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/tenants/:id<int>/invites/accept -> tenant.AcceptInvite")
|
|
router.Post("/v1/t/:tenantCode/tenants/:id<int>/invites/accept"[len(r.Path()):], Func2(
|
|
r.tenant.AcceptInvite,
|
|
PathParam[int64]("id"),
|
|
Body[dto.TenantInviteAcceptForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/tenants/:id<int>/join -> tenant.ApplyJoin")
|
|
router.Post("/v1/t/:tenantCode/tenants/:id<int>/join"[len(r.Path()):], Func2(
|
|
r.tenant.ApplyJoin,
|
|
PathParam[int64]("id"),
|
|
Body[dto.TenantJoinApplyForm]("form"),
|
|
))
|
|
// Register routes for controller: Transaction
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/orders/:id<int>/status -> transaction.Status")
|
|
router.Get("/v1/t/:tenantCode/orders/:id<int>/status"[len(r.Path()):], DataFunc1(
|
|
r.transaction.Status,
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/orders -> transaction.Create")
|
|
router.Post("/v1/t/:tenantCode/orders"[len(r.Path()):], DataFunc1(
|
|
r.transaction.Create,
|
|
Body[dto.OrderCreateForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/orders/:id<int>/pay -> transaction.Pay")
|
|
router.Post("/v1/t/:tenantCode/orders/:id<int>/pay"[len(r.Path()):], DataFunc2(
|
|
r.transaction.Pay,
|
|
PathParam[int64]("id"),
|
|
Body[dto.OrderPayForm]("form"),
|
|
))
|
|
// Register routes for controller: User
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/me/favorites/:contentId<int> -> user.RemoveFavorite")
|
|
router.Delete("/v1/t/:tenantCode/me/favorites/:contentId<int>"[len(r.Path()):], Func2(
|
|
r.user.RemoveFavorite,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[int64]("contentId"),
|
|
))
|
|
r.log.Debugf("Registering route: Delete /v1/t/:tenantCode/me/likes/:contentId<int> -> user.RemoveLike")
|
|
router.Delete("/v1/t/:tenantCode/me/likes/:contentId<int>"[len(r.Path()):], Func2(
|
|
r.user.RemoveLike,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[int64]("contentId"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me -> user.Me")
|
|
router.Get("/v1/t/:tenantCode/me"[len(r.Path()):], DataFunc1(
|
|
r.user.Me,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/coupons -> user.MyCoupons")
|
|
router.Get("/v1/t/:tenantCode/me/coupons"[len(r.Path()):], DataFunc2(
|
|
r.user.MyCoupons,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[string]("status"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/coupons/available -> user.AvailableCoupons")
|
|
router.Get("/v1/t/:tenantCode/me/coupons/available"[len(r.Path()):], DataFunc2(
|
|
r.user.AvailableCoupons,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[int64]("amount"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/favorites -> user.Favorites")
|
|
router.Get("/v1/t/:tenantCode/me/favorites"[len(r.Path()):], DataFunc1(
|
|
r.user.Favorites,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/following -> user.Following")
|
|
router.Get("/v1/t/:tenantCode/me/following"[len(r.Path()):], DataFunc1(
|
|
r.user.Following,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/library -> user.Library")
|
|
router.Get("/v1/t/:tenantCode/me/library"[len(r.Path()):], DataFunc1(
|
|
r.user.Library,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/likes -> user.Likes")
|
|
router.Get("/v1/t/:tenantCode/me/likes"[len(r.Path()):], DataFunc1(
|
|
r.user.Likes,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/notifications -> user.Notifications")
|
|
router.Get("/v1/t/:tenantCode/me/notifications"[len(r.Path()):], DataFunc3(
|
|
r.user.Notifications,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[string]("type"),
|
|
QueryParam[int]("page"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/orders -> user.ListOrders")
|
|
router.Get("/v1/t/:tenantCode/me/orders"[len(r.Path()):], DataFunc2(
|
|
r.user.ListOrders,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[string]("status"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/orders/:id<int> -> user.GetOrder")
|
|
router.Get("/v1/t/:tenantCode/me/orders/:id<int>"[len(r.Path()):], DataFunc2(
|
|
r.user.GetOrder,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Get /v1/t/:tenantCode/me/wallet -> user.Wallet")
|
|
router.Get("/v1/t/:tenantCode/me/wallet"[len(r.Path()):], DataFunc1(
|
|
r.user.Wallet,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/coupons/receive -> user.ReceiveCoupon")
|
|
router.Post("/v1/t/:tenantCode/me/coupons/receive"[len(r.Path()):], DataFunc2(
|
|
r.user.ReceiveCoupon,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.CouponReceiveForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/favorites -> user.AddFavorite")
|
|
router.Post("/v1/t/:tenantCode/me/favorites"[len(r.Path()):], Func2(
|
|
r.user.AddFavorite,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[int64]("content_id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/likes -> user.AddLike")
|
|
router.Post("/v1/t/:tenantCode/me/likes"[len(r.Path()):], Func2(
|
|
r.user.AddLike,
|
|
Local[*models.User]("__ctx_user"),
|
|
QueryParam[int64]("content_id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/notifications/:id<int>/read -> user.MarkNotificationRead")
|
|
router.Post("/v1/t/:tenantCode/me/notifications/:id<int>/read"[len(r.Path()):], Func2(
|
|
r.user.MarkNotificationRead,
|
|
Local[*models.User]("__ctx_user"),
|
|
PathParam[int64]("id"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/notifications/read-all -> user.MarkAllNotificationsRead")
|
|
router.Post("/v1/t/:tenantCode/me/notifications/read-all"[len(r.Path()):], Func1(
|
|
r.user.MarkAllNotificationsRead,
|
|
Local[*models.User]("__ctx_user"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/realname -> user.RealName")
|
|
router.Post("/v1/t/:tenantCode/me/realname"[len(r.Path()):], Func2(
|
|
r.user.RealName,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.RealNameForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Post /v1/t/:tenantCode/me/wallet/recharge -> user.Recharge")
|
|
router.Post("/v1/t/:tenantCode/me/wallet/recharge"[len(r.Path()):], DataFunc2(
|
|
r.user.Recharge,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.RechargeForm]("form"),
|
|
))
|
|
r.log.Debugf("Registering route: Put /v1/t/:tenantCode/me -> user.Update")
|
|
router.Put("/v1/t/:tenantCode/me"[len(r.Path()):], Func2(
|
|
r.user.Update,
|
|
Local[*models.User]("__ctx_user"),
|
|
Body[dto.UserUpdate]("form"),
|
|
))
|
|
|
|
r.log.Info("Successfully registered all routes")
|
|
}
|