feat: tenant-scoped routing and portal navigation
This commit is contained in:
@@ -50,368 +50,368 @@ func (r *Routes) Name() string {
|
||||
// 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/media-assets/:id<int> -> common.DeleteMediaAsset")
|
||||
router.Delete("/v1/media-assets/:id<int>"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/media-assets/:id<int> -> common.DeleteMediaAsset")
|
||||
router.Delete("/t/:tenantCode/v1/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/upload/:uploadId -> common.AbortUpload")
|
||||
router.Delete("/v1/upload/:uploadId"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/upload/:uploadId -> common.AbortUpload")
|
||||
router.Delete("/t/:tenantCode/v1/upload/:uploadId"[len(r.Path()):], Func2(
|
||||
r.common.AbortUpload,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[string]("uploadId"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/common/options -> common.GetOptions")
|
||||
router.Get("/v1/common/options"[len(r.Path()):], DataFunc0(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/common/options -> common.GetOptions")
|
||||
router.Get("/t/:tenantCode/v1/common/options"[len(r.Path()):], DataFunc0(
|
||||
r.common.GetOptions,
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/upload/check -> common.CheckHash")
|
||||
router.Get("/v1/upload/check"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/upload/check -> common.CheckHash")
|
||||
router.Get("/t/:tenantCode/v1/upload/check"[len(r.Path()):], DataFunc2(
|
||||
r.common.CheckHash,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[string]("hash"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/upload -> common.Upload")
|
||||
router.Post("/v1/upload"[len(r.Path()):], DataFunc3(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/upload -> common.Upload")
|
||||
router.Post("/t/:tenantCode/v1/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/upload/complete -> common.CompleteUpload")
|
||||
router.Post("/v1/upload/complete"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/upload/complete -> common.CompleteUpload")
|
||||
router.Post("/t/:tenantCode/v1/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/upload/init -> common.InitUpload")
|
||||
router.Post("/v1/upload/init"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/upload/init -> common.InitUpload")
|
||||
router.Post("/t/:tenantCode/v1/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/upload/part -> common.UploadPart")
|
||||
router.Post("/v1/upload/part"[len(r.Path()):], Func3(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/upload/part -> common.UploadPart")
|
||||
router.Post("/t/:tenantCode/v1/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/contents/:id<int>/favorite -> content.RemoveFavorite")
|
||||
router.Delete("/v1/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/contents/:id<int>/favorite -> content.RemoveFavorite")
|
||||
router.Delete("/t/:tenantCode/v1/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
||||
r.content.RemoveFavorite,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Delete /v1/contents/:id<int>/like -> content.RemoveLike")
|
||||
router.Delete("/v1/contents/:id<int>/like"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/contents/:id<int>/like -> content.RemoveLike")
|
||||
router.Delete("/t/:tenantCode/v1/contents/:id<int>/like"[len(r.Path()):], Func1(
|
||||
r.content.RemoveLike,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/contents -> content.List")
|
||||
router.Get("/v1/contents"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents -> content.List")
|
||||
router.Get("/t/:tenantCode/v1/contents"[len(r.Path()):], DataFunc1(
|
||||
r.content.List,
|
||||
Query[dto.ContentListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/contents/:id<int> -> content.Get")
|
||||
router.Get("/v1/contents/:id<int>"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents/:id<int> -> content.Get")
|
||||
router.Get("/t/:tenantCode/v1/contents/:id<int>"[len(r.Path()):], DataFunc1(
|
||||
r.content.Get,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/contents/:id<int>/comments -> content.ListComments")
|
||||
router.Get("/v1/contents/:id<int>/comments"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/contents/:id<int>/comments -> content.ListComments")
|
||||
router.Get("/t/:tenantCode/v1/contents/:id<int>/comments"[len(r.Path()):], DataFunc2(
|
||||
r.content.ListComments,
|
||||
PathParam[int64]("id"),
|
||||
QueryParam[int]("page"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/topics -> content.ListTopics")
|
||||
router.Get("/v1/topics"[len(r.Path()):], DataFunc0(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/topics -> content.ListTopics")
|
||||
router.Get("/t/:tenantCode/v1/topics"[len(r.Path()):], DataFunc0(
|
||||
r.content.ListTopics,
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/comments/:id<int>/like -> content.LikeComment")
|
||||
router.Post("/v1/comments/:id<int>/like"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/comments/:id<int>/like -> content.LikeComment")
|
||||
router.Post("/t/:tenantCode/v1/comments/:id<int>/like"[len(r.Path()):], Func1(
|
||||
r.content.LikeComment,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/contents/:id<int>/comments -> content.CreateComment")
|
||||
router.Post("/v1/contents/:id<int>/comments"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/contents/:id<int>/comments -> content.CreateComment")
|
||||
router.Post("/t/:tenantCode/v1/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/contents/:id<int>/favorite -> content.AddFavorite")
|
||||
router.Post("/v1/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/contents/:id<int>/favorite -> content.AddFavorite")
|
||||
router.Post("/t/:tenantCode/v1/contents/:id<int>/favorite"[len(r.Path()):], Func1(
|
||||
r.content.AddFavorite,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/contents/:id<int>/like -> content.AddLike")
|
||||
router.Post("/v1/contents/:id<int>/like"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/contents/:id<int>/like -> content.AddLike")
|
||||
router.Post("/t/:tenantCode/v1/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/creator/contents/:id<int> -> creator.DeleteContent")
|
||||
router.Delete("/v1/creator/contents/:id<int>"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/creator/contents/:id<int> -> creator.DeleteContent")
|
||||
router.Delete("/t/:tenantCode/v1/creator/contents/:id<int>"[len(r.Path()):], Func2(
|
||||
r.creator.DeleteContent,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Delete /v1/creator/payout-accounts -> creator.RemovePayoutAccount")
|
||||
router.Delete("/v1/creator/payout-accounts"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/creator/payout-accounts -> creator.RemovePayoutAccount")
|
||||
router.Delete("/t/:tenantCode/v1/creator/payout-accounts"[len(r.Path()):], Func2(
|
||||
r.creator.RemovePayoutAccount,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/contents -> creator.ListContents")
|
||||
router.Get("/v1/creator/contents"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/contents -> creator.ListContents")
|
||||
router.Get("/t/:tenantCode/v1/creator/contents"[len(r.Path()):], DataFunc2(
|
||||
r.creator.ListContents,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Query[dto.CreatorContentListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/contents/:id<int> -> creator.GetContent")
|
||||
router.Get("/v1/creator/contents/:id<int>"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/contents/:id<int> -> creator.GetContent")
|
||||
router.Get("/t/:tenantCode/v1/creator/contents/:id<int>"[len(r.Path()):], DataFunc2(
|
||||
r.creator.GetContent,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/dashboard -> creator.Dashboard")
|
||||
router.Get("/v1/creator/dashboard"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/dashboard -> creator.Dashboard")
|
||||
router.Get("/t/:tenantCode/v1/creator/dashboard"[len(r.Path()):], DataFunc1(
|
||||
r.creator.Dashboard,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/orders -> creator.ListOrders")
|
||||
router.Get("/v1/creator/orders"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/orders -> creator.ListOrders")
|
||||
router.Get("/t/:tenantCode/v1/creator/orders"[len(r.Path()):], DataFunc2(
|
||||
r.creator.ListOrders,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Query[dto.CreatorOrderListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/payout-accounts -> creator.ListPayoutAccounts")
|
||||
router.Get("/v1/creator/payout-accounts"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/payout-accounts -> creator.ListPayoutAccounts")
|
||||
router.Get("/t/:tenantCode/v1/creator/payout-accounts"[len(r.Path()):], DataFunc1(
|
||||
r.creator.ListPayoutAccounts,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creator/settings -> creator.GetSettings")
|
||||
router.Get("/v1/creator/settings"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creator/settings -> creator.GetSettings")
|
||||
router.Get("/t/:tenantCode/v1/creator/settings"[len(r.Path()):], DataFunc1(
|
||||
r.creator.GetSettings,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/creator/apply -> creator.Apply")
|
||||
router.Post("/v1/creator/apply"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/creator/apply -> creator.Apply")
|
||||
router.Post("/t/:tenantCode/v1/creator/apply"[len(r.Path()):], Func2(
|
||||
r.creator.Apply,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.ApplyForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/creator/contents -> creator.CreateContent")
|
||||
router.Post("/v1/creator/contents"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/creator/contents -> creator.CreateContent")
|
||||
router.Post("/t/:tenantCode/v1/creator/contents"[len(r.Path()):], Func2(
|
||||
r.creator.CreateContent,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.ContentCreateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/creator/orders/:id<int>/refund -> creator.Refund")
|
||||
router.Post("/v1/creator/orders/:id<int>/refund"[len(r.Path()):], Func3(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/creator/orders/:id<int>/refund -> creator.Refund")
|
||||
router.Post("/t/:tenantCode/v1/creator/orders/:id<int>/refund"[len(r.Path()):], Func3(
|
||||
r.creator.Refund,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.RefundForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/creator/payout-accounts -> creator.AddPayoutAccount")
|
||||
router.Post("/v1/creator/payout-accounts"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/creator/payout-accounts -> creator.AddPayoutAccount")
|
||||
router.Post("/t/:tenantCode/v1/creator/payout-accounts"[len(r.Path()):], Func2(
|
||||
r.creator.AddPayoutAccount,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.PayoutAccount]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/creator/withdraw -> creator.Withdraw")
|
||||
router.Post("/v1/creator/withdraw"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/creator/withdraw -> creator.Withdraw")
|
||||
router.Post("/t/:tenantCode/v1/creator/withdraw"[len(r.Path()):], Func2(
|
||||
r.creator.Withdraw,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.WithdrawForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Put /v1/creator/contents/:id<int> -> creator.UpdateContent")
|
||||
router.Put("/v1/creator/contents/:id<int>"[len(r.Path()):], Func3(
|
||||
r.log.Debugf("Registering route: Put /t/:tenantCode/v1/creator/contents/:id<int> -> creator.UpdateContent")
|
||||
router.Put("/t/:tenantCode/v1/creator/contents/:id<int>"[len(r.Path()):], Func3(
|
||||
r.creator.UpdateContent,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.ContentUpdateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Put /v1/creator/settings -> creator.UpdateSettings")
|
||||
router.Put("/v1/creator/settings"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Put /t/:tenantCode/v1/creator/settings -> creator.UpdateSettings")
|
||||
router.Put("/t/:tenantCode/v1/creator/settings"[len(r.Path()):], Func2(
|
||||
r.creator.UpdateSettings,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.Settings]("form"),
|
||||
))
|
||||
// Register routes for controller: Storage
|
||||
r.log.Debugf("Registering route: Get /v1/storage/* -> storage.Download")
|
||||
router.Get("/v1/storage/*"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/storage/* -> storage.Download")
|
||||
router.Get("/t/:tenantCode/v1/storage/*"[len(r.Path()):], Func2(
|
||||
r.storage.Download,
|
||||
QueryParam[string]("expires"),
|
||||
QueryParam[string]("sign"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Put /v1/storage/* -> storage.Upload")
|
||||
router.Put("/v1/storage/*"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Put /t/:tenantCode/v1/storage/* -> storage.Upload")
|
||||
router.Put("/t/:tenantCode/v1/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/tenants/:id<int>/follow -> tenant.Unfollow")
|
||||
router.Delete("/v1/tenants/:id<int>/follow"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/tenants/:id<int>/follow -> tenant.Unfollow")
|
||||
router.Delete("/t/:tenantCode/v1/tenants/:id<int>/follow"[len(r.Path()):], Func2(
|
||||
r.tenant.Unfollow,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/creators/:id<int>/contents -> tenant.ListContents")
|
||||
router.Get("/v1/creators/:id<int>/contents"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/creators/:id<int>/contents -> tenant.ListContents")
|
||||
router.Get("/t/:tenantCode/v1/creators/:id<int>/contents"[len(r.Path()):], DataFunc2(
|
||||
r.tenant.ListContents,
|
||||
PathParam[int64]("id"),
|
||||
Query[dto.ContentListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/tenants -> tenant.List")
|
||||
router.Get("/v1/tenants"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/tenants -> tenant.List")
|
||||
router.Get("/t/:tenantCode/v1/tenants"[len(r.Path()):], DataFunc1(
|
||||
r.tenant.List,
|
||||
Query[dto.TenantListFilter]("filter"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/tenants/:id<int> -> tenant.Get")
|
||||
router.Get("/v1/tenants/:id<int>"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/tenants/:id<int> -> tenant.Get")
|
||||
router.Get("/t/:tenantCode/v1/tenants/:id<int>"[len(r.Path()):], DataFunc2(
|
||||
r.tenant.Get,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/tenants/:id<int>/follow -> tenant.Follow")
|
||||
router.Post("/v1/tenants/:id<int>/follow"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/tenants/:id<int>/follow -> tenant.Follow")
|
||||
router.Post("/t/:tenantCode/v1/tenants/:id<int>/follow"[len(r.Path()):], Func2(
|
||||
r.tenant.Follow,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
// Register routes for controller: Transaction
|
||||
r.log.Debugf("Registering route: Get /v1/orders/:id<int>/status -> transaction.Status")
|
||||
router.Get("/v1/orders/:id<int>/status"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/orders/:id<int>/status -> transaction.Status")
|
||||
router.Get("/t/:tenantCode/v1/orders/:id<int>/status"[len(r.Path()):], DataFunc1(
|
||||
r.transaction.Status,
|
||||
PathParam[int64]("id"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/orders -> transaction.Create")
|
||||
router.Post("/v1/orders"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/orders -> transaction.Create")
|
||||
router.Post("/t/:tenantCode/v1/orders"[len(r.Path()):], DataFunc2(
|
||||
r.transaction.Create,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.OrderCreateForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/orders/:id<int>/pay -> transaction.Pay")
|
||||
router.Post("/v1/orders/:id<int>/pay"[len(r.Path()):], DataFunc3(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/orders/:id<int>/pay -> transaction.Pay")
|
||||
router.Post("/t/:tenantCode/v1/orders/:id<int>/pay"[len(r.Path()):], DataFunc3(
|
||||
r.transaction.Pay,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
PathParam[int64]("id"),
|
||||
Body[dto.OrderPayForm]("form"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/webhook/payment/notify -> transaction.Webhook")
|
||||
router.Post("/v1/webhook/payment/notify"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/webhook/payment/notify -> transaction.Webhook")
|
||||
router.Post("/t/:tenantCode/v1/webhook/payment/notify"[len(r.Path()):], DataFunc1(
|
||||
r.transaction.Webhook,
|
||||
Body[WebhookForm]("form"),
|
||||
))
|
||||
// Register routes for controller: User
|
||||
r.log.Debugf("Registering route: Delete /v1/me/favorites/:contentId<int> -> user.RemoveFavorite")
|
||||
router.Delete("/v1/me/favorites/:contentId<int>"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/me/favorites/:contentId<int> -> user.RemoveFavorite")
|
||||
router.Delete("/t/:tenantCode/v1/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/me/likes/:contentId<int> -> user.RemoveLike")
|
||||
router.Delete("/v1/me/likes/:contentId<int>"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Delete /t/:tenantCode/v1/me/likes/:contentId<int> -> user.RemoveLike")
|
||||
router.Delete("/t/:tenantCode/v1/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/me -> user.Me")
|
||||
router.Get("/v1/me"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me -> user.Me")
|
||||
router.Get("/t/:tenantCode/v1/me"[len(r.Path()):], DataFunc1(
|
||||
r.user.Me,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/coupons -> user.MyCoupons")
|
||||
router.Get("/v1/me/coupons"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/coupons -> user.MyCoupons")
|
||||
router.Get("/t/:tenantCode/v1/me/coupons"[len(r.Path()):], DataFunc2(
|
||||
r.user.MyCoupons,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[string]("status"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/favorites -> user.Favorites")
|
||||
router.Get("/v1/me/favorites"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/favorites -> user.Favorites")
|
||||
router.Get("/t/:tenantCode/v1/me/favorites"[len(r.Path()):], DataFunc1(
|
||||
r.user.Favorites,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/following -> user.Following")
|
||||
router.Get("/v1/me/following"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/following -> user.Following")
|
||||
router.Get("/t/:tenantCode/v1/me/following"[len(r.Path()):], DataFunc1(
|
||||
r.user.Following,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/library -> user.Library")
|
||||
router.Get("/v1/me/library"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/library -> user.Library")
|
||||
router.Get("/t/:tenantCode/v1/me/library"[len(r.Path()):], DataFunc1(
|
||||
r.user.Library,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/likes -> user.Likes")
|
||||
router.Get("/v1/me/likes"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/likes -> user.Likes")
|
||||
router.Get("/t/:tenantCode/v1/me/likes"[len(r.Path()):], DataFunc1(
|
||||
r.user.Likes,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/notifications -> user.Notifications")
|
||||
router.Get("/v1/me/notifications"[len(r.Path()):], DataFunc3(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/notifications -> user.Notifications")
|
||||
router.Get("/t/:tenantCode/v1/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/me/orders -> user.ListOrders")
|
||||
router.Get("/v1/me/orders"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/orders -> user.ListOrders")
|
||||
router.Get("/t/:tenantCode/v1/me/orders"[len(r.Path()):], DataFunc2(
|
||||
r.user.ListOrders,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[string]("status"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Get /v1/me/orders/:id<int> -> user.GetOrder")
|
||||
router.Get("/v1/me/orders/:id<int>"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/orders/:id<int> -> user.GetOrder")
|
||||
router.Get("/t/:tenantCode/v1/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/me/wallet -> user.Wallet")
|
||||
router.Get("/v1/me/wallet"[len(r.Path()):], DataFunc1(
|
||||
r.log.Debugf("Registering route: Get /t/:tenantCode/v1/me/wallet -> user.Wallet")
|
||||
router.Get("/t/:tenantCode/v1/me/wallet"[len(r.Path()):], DataFunc1(
|
||||
r.user.Wallet,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/me/favorites -> user.AddFavorite")
|
||||
router.Post("/v1/me/favorites"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/favorites -> user.AddFavorite")
|
||||
router.Post("/t/:tenantCode/v1/me/favorites"[len(r.Path()):], Func2(
|
||||
r.user.AddFavorite,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[int64]("contentId"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/me/likes -> user.AddLike")
|
||||
router.Post("/v1/me/likes"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/likes -> user.AddLike")
|
||||
router.Post("/t/:tenantCode/v1/me/likes"[len(r.Path()):], Func2(
|
||||
r.user.AddLike,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
QueryParam[int64]("contentId"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/me/notifications/:id<int>/read -> user.MarkNotificationRead")
|
||||
router.Post("/v1/me/notifications/:id<int>/read"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/notifications/:id<int>/read -> user.MarkNotificationRead")
|
||||
router.Post("/t/:tenantCode/v1/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/me/notifications/read-all -> user.MarkAllNotificationsRead")
|
||||
router.Post("/v1/me/notifications/read-all"[len(r.Path()):], Func1(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/notifications/read-all -> user.MarkAllNotificationsRead")
|
||||
router.Post("/t/:tenantCode/v1/me/notifications/read-all"[len(r.Path()):], Func1(
|
||||
r.user.MarkAllNotificationsRead,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
))
|
||||
r.log.Debugf("Registering route: Post /v1/me/realname -> user.RealName")
|
||||
router.Post("/v1/me/realname"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/realname -> user.RealName")
|
||||
router.Post("/t/:tenantCode/v1/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/me/wallet/recharge -> user.Recharge")
|
||||
router.Post("/v1/me/wallet/recharge"[len(r.Path()):], DataFunc2(
|
||||
r.log.Debugf("Registering route: Post /t/:tenantCode/v1/me/wallet/recharge -> user.Recharge")
|
||||
router.Post("/t/:tenantCode/v1/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/me -> user.Update")
|
||||
router.Put("/v1/me"[len(r.Path()):], Func2(
|
||||
r.log.Debugf("Registering route: Put /t/:tenantCode/v1/me -> user.Update")
|
||||
router.Put("/t/:tenantCode/v1/me"[len(r.Path()):], Func2(
|
||||
r.user.Update,
|
||||
Local[*models.User]("__ctx_user"),
|
||||
Body[dto.UserUpdate]("form"),
|
||||
|
||||
Reference in New Issue
Block a user