refactor: 移除不必要的上下文调用,简化服务方法参数
This commit is contained in:
@@ -22,7 +22,7 @@ type auth struct{}
|
||||
// @Success 200 {object} dto.LoginResponse
|
||||
// @Bind form body
|
||||
func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
|
||||
return services.Super.Login(ctx.Context(), form)
|
||||
return services.Super.Login(ctx, form)
|
||||
}
|
||||
|
||||
// Check Token
|
||||
@@ -35,5 +35,5 @@ func (c *auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, er
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.LoginResponse
|
||||
func (c *auth) CheckToken(ctx fiber.Ctx) (*dto.LoginResponse, error) {
|
||||
return services.Super.CheckToken(ctx.Context())
|
||||
return services.Super.CheckToken(ctx)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type contents struct{}
|
||||
// @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)
|
||||
return services.Super.ListContents(ctx, filter)
|
||||
}
|
||||
|
||||
// Update content status
|
||||
@@ -43,5 +43,5 @@ func (c *contents) List(ctx fiber.Ctx, filter *dto.SuperContentListFilter) (*req
|
||||
// @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)
|
||||
return services.Super.UpdateContentStatus(ctx, tenantID, contentID, form)
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ type orders struct{}
|
||||
// @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)
|
||||
return services.Super.ListOrders(ctx, filter)
|
||||
}
|
||||
|
||||
// Get order
|
||||
@@ -39,7 +39,7 @@ func (c *orders) List(ctx fiber.Ctx, filter *dto.SuperOrderListFilter) (*request
|
||||
// @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)
|
||||
return services.Super.GetOrder(ctx, id)
|
||||
}
|
||||
|
||||
// Refund order
|
||||
@@ -56,7 +56,7 @@ func (c *orders) Get(ctx fiber.Ctx, id int64) (*dto.SuperOrderDetail, error) {
|
||||
// @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)
|
||||
return services.Super.RefundOrder(ctx, id, form)
|
||||
}
|
||||
|
||||
// Order statistics
|
||||
@@ -69,5 +69,5 @@ func (c *orders) Refund(ctx fiber.Ctx, id int64, form *dto.SuperOrderRefundForm)
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.OrderStatisticsResponse
|
||||
func (c *orders) Statistics(ctx fiber.Ctx) (*dto.OrderStatisticsResponse, error) {
|
||||
return services.Super.OrderStatistics(ctx.Context())
|
||||
return services.Super.OrderStatistics(ctx)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type tenants struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.TenantItem}
|
||||
// @Bind filter query
|
||||
func (c *tenants) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListTenants(ctx.Context(), filter)
|
||||
return services.Super.ListTenants(ctx, filter)
|
||||
}
|
||||
|
||||
// Create tenant
|
||||
@@ -40,7 +40,7 @@ func (c *tenants) List(ctx fiber.Ctx, filter *dto.TenantListFilter) (*requests.P
|
||||
// @Success 200 {string} string "Created"
|
||||
// @Bind form body
|
||||
func (c *tenants) Create(ctx fiber.Ctx, form *dto.TenantCreateForm) error {
|
||||
return services.Super.CreateTenant(ctx.Context(), form)
|
||||
return services.Super.CreateTenant(ctx, form)
|
||||
}
|
||||
|
||||
// Get tenant
|
||||
@@ -55,7 +55,7 @@ func (c *tenants) Create(ctx fiber.Ctx, form *dto.TenantCreateForm) error {
|
||||
// @Success 200 {object} dto.TenantItem
|
||||
// @Bind id path
|
||||
func (c *tenants) Get(ctx fiber.Ctx, id int64) (*dto.TenantItem, error) {
|
||||
return services.Super.GetTenant(ctx.Context(), id)
|
||||
return services.Super.GetTenant(ctx, id)
|
||||
}
|
||||
|
||||
// Update tenant status
|
||||
@@ -72,7 +72,7 @@ func (c *tenants) Get(ctx fiber.Ctx, id int64) (*dto.TenantItem, error) {
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *tenants) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.TenantStatusUpdateForm) error {
|
||||
return services.Super.UpdateTenantStatus(ctx.Context(), id, form)
|
||||
return services.Super.UpdateTenantStatus(ctx, id, form)
|
||||
}
|
||||
|
||||
// Update tenant expire
|
||||
@@ -89,7 +89,7 @@ func (c *tenants) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.TenantStatusUp
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *tenants) UpdateExpire(ctx fiber.Ctx, id int64, form *dto.TenantExpireUpdateForm) error {
|
||||
return services.Super.UpdateTenantExpire(ctx.Context(), id, form)
|
||||
return services.Super.UpdateTenantExpire(ctx, id, form)
|
||||
}
|
||||
|
||||
// Tenant statuses
|
||||
@@ -102,5 +102,5 @@ func (c *tenants) UpdateExpire(ctx fiber.Ctx, id int64, form *dto.TenantExpireUp
|
||||
// @Produce json
|
||||
// @Success 200 {array} requests.KV
|
||||
func (c *tenants) Statuses(ctx fiber.Ctx) ([]requests.KV, error) {
|
||||
return services.Super.TenantStatuses(ctx.Context())
|
||||
return services.Super.TenantStatuses(ctx)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type users struct{}
|
||||
// @Success 200 {object} requests.Pager{items=[]dto.UserItem}
|
||||
// @Bind filter query
|
||||
func (c *users) List(ctx fiber.Ctx, filter *dto.UserListFilter) (*requests.Pager, error) {
|
||||
return services.Super.ListUsers(ctx.Context(), filter)
|
||||
return services.Super.ListUsers(ctx, filter)
|
||||
}
|
||||
|
||||
// Get user
|
||||
@@ -40,7 +40,7 @@ func (c *users) List(ctx fiber.Ctx, filter *dto.UserListFilter) (*requests.Pager
|
||||
// @Success 200 {object} dto.UserItem
|
||||
// @Bind id path
|
||||
func (c *users) Get(ctx fiber.Ctx, id int64) (*dto.UserItem, error) {
|
||||
return services.Super.GetUser(ctx.Context(), id)
|
||||
return services.Super.GetUser(ctx, id)
|
||||
}
|
||||
|
||||
// Update user status
|
||||
@@ -57,7 +57,7 @@ func (c *users) Get(ctx fiber.Ctx, id int64) (*dto.UserItem, error) {
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.UserStatusUpdateForm) error {
|
||||
return services.Super.UpdateUserStatus(ctx.Context(), id, form)
|
||||
return services.Super.UpdateUserStatus(ctx, id, form)
|
||||
}
|
||||
|
||||
// Update user roles
|
||||
@@ -74,7 +74,7 @@ func (c *users) UpdateStatus(ctx fiber.Ctx, id int64, form *dto.UserStatusUpdate
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateForm) error {
|
||||
return services.Super.UpdateUserRoles(ctx.Context(), id, form)
|
||||
return services.Super.UpdateUserRoles(ctx, id, form)
|
||||
}
|
||||
|
||||
// User statistics
|
||||
@@ -87,7 +87,7 @@ func (c *users) UpdateRoles(ctx fiber.Ctx, id int64, form *dto.UserRolesUpdateFo
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.UserStatistics
|
||||
func (c *users) Statistics(ctx fiber.Ctx) ([]dto.UserStatistics, error) {
|
||||
return services.Super.UserStatistics(ctx.Context())
|
||||
return services.Super.UserStatistics(ctx)
|
||||
}
|
||||
|
||||
// User statuses
|
||||
@@ -100,5 +100,5 @@ func (c *users) Statistics(ctx fiber.Ctx) ([]dto.UserStatistics, error) {
|
||||
// @Produce json
|
||||
// @Success 200 {array} requests.KV
|
||||
func (c *users) Statuses(ctx fiber.Ctx) ([]requests.KV, error) {
|
||||
return services.Super.UserStatuses(ctx.Context())
|
||||
return services.Super.UserStatuses(ctx)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Auth struct{}
|
||||
// @Success 200 {object} string "OTP sent"
|
||||
// @Bind form body
|
||||
func (a *Auth) SendOTP(ctx fiber.Ctx, form *dto.SendOTPForm) error {
|
||||
return services.User.SendOTP(ctx.Context(), form.Phone)
|
||||
return services.User.SendOTP(ctx, form.Phone)
|
||||
}
|
||||
|
||||
// Login logs in or registers a user with OTP.
|
||||
@@ -37,5 +37,5 @@ func (a *Auth) SendOTP(ctx fiber.Ctx, form *dto.SendOTPForm) error {
|
||||
// @Success 200 {object} dto.LoginResponse
|
||||
// @Bind form body
|
||||
func (a *Auth) Login(ctx fiber.Ctx, form *dto.LoginForm) (*dto.LoginResponse, error) {
|
||||
return services.User.LoginWithOTP(ctx.Context(), form.Phone, form.OTP)
|
||||
return services.User.LoginWithOTP(ctx, form.Phone, form.OTP)
|
||||
}
|
||||
|
||||
@@ -30,5 +30,5 @@ func (c *Common) Upload(ctx fiber.Ctx, file *multipart.FileHeader, typeArg *stri
|
||||
if typeArg != nil {
|
||||
val = *typeArg
|
||||
}
|
||||
return services.Common.Upload(ctx.Context(), file, val)
|
||||
return services.Common.Upload(ctx, file, val)
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ func (c *Content) List(
|
||||
ctx fiber.Ctx,
|
||||
filter *dto.ContentListFilter,
|
||||
) (*requests.Pager, error) {
|
||||
return services.Content.List(ctx.Context(), filter)
|
||||
return services.Content.List(ctx, filter)
|
||||
}
|
||||
|
||||
// Get content detail
|
||||
@@ -45,7 +45,7 @@ func (c *Content) List(
|
||||
// @Success 200 {object} dto.ContentDetail
|
||||
// @Bind id path
|
||||
func (c *Content) Get(ctx fiber.Ctx, id string) (*dto.ContentDetail, error) {
|
||||
return services.Content.Get(ctx.Context(), id)
|
||||
return services.Content.Get(ctx, id)
|
||||
}
|
||||
|
||||
// Get comments for a content
|
||||
@@ -62,7 +62,7 @@ func (c *Content) Get(ctx fiber.Ctx, id string) (*dto.ContentDetail, error) {
|
||||
// @Bind id path
|
||||
// @Bind page query
|
||||
func (c *Content) ListComments(ctx fiber.Ctx, id string, page int) (*requests.Pager, error) {
|
||||
return services.Content.ListComments(ctx.Context(), id, page)
|
||||
return services.Content.ListComments(ctx, id, page)
|
||||
}
|
||||
|
||||
// Post a comment
|
||||
@@ -79,7 +79,7 @@ func (c *Content) ListComments(ctx fiber.Ctx, id string, page int) (*requests.Pa
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Content) CreateComment(ctx fiber.Ctx, id string, form *dto.CommentCreateForm) error {
|
||||
return services.Content.CreateComment(ctx.Context(), id, form)
|
||||
return services.Content.CreateComment(ctx, id, form)
|
||||
}
|
||||
|
||||
// Like a comment
|
||||
@@ -94,7 +94,7 @@ func (c *Content) CreateComment(ctx fiber.Ctx, id string, form *dto.CommentCreat
|
||||
// @Success 200 {string} string "Liked"
|
||||
// @Bind id path
|
||||
func (c *Content) LikeComment(ctx fiber.Ctx, id string) error {
|
||||
return services.Content.LikeComment(ctx.Context(), id)
|
||||
return services.Content.LikeComment(ctx, id)
|
||||
}
|
||||
|
||||
// List curated topics
|
||||
@@ -107,5 +107,5 @@ func (c *Content) LikeComment(ctx fiber.Ctx, id string) error {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.Topic
|
||||
func (c *Content) ListTopics(ctx fiber.Ctx) ([]dto.Topic, error) {
|
||||
return services.Content.ListTopics(ctx.Context())
|
||||
return services.Content.ListTopics(ctx)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Creator struct{}
|
||||
// @Success 200 {string} string "Application submitted"
|
||||
// @Bind form body
|
||||
func (c *Creator) Apply(ctx fiber.Ctx, form *dto.ApplyForm) error {
|
||||
return services.Creator.Apply(ctx.Context(), form)
|
||||
return services.Creator.Apply(ctx, form)
|
||||
}
|
||||
|
||||
// Get creator dashboard stats
|
||||
@@ -35,7 +35,7 @@ func (c *Creator) Apply(ctx fiber.Ctx, form *dto.ApplyForm) error {
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.DashboardStats
|
||||
func (c *Creator) Dashboard(ctx fiber.Ctx) (*dto.DashboardStats, error) {
|
||||
return services.Creator.Dashboard(ctx.Context())
|
||||
return services.Creator.Dashboard(ctx)
|
||||
}
|
||||
|
||||
// List creator contents
|
||||
@@ -52,7 +52,7 @@ func (c *Creator) Dashboard(ctx fiber.Ctx) (*dto.DashboardStats, error) {
|
||||
// @Success 200 {array} dto.ContentItem
|
||||
// @Bind filter query
|
||||
func (c *Creator) ListContents(ctx fiber.Ctx, filter *dto.CreatorContentListFilter) ([]dto.ContentItem, error) {
|
||||
return services.Creator.ListContents(ctx.Context(), filter)
|
||||
return services.Creator.ListContents(ctx, filter)
|
||||
}
|
||||
|
||||
// Create/Publish content
|
||||
@@ -67,7 +67,7 @@ func (c *Creator) ListContents(ctx fiber.Ctx, filter *dto.CreatorContentListFilt
|
||||
// @Success 200 {string} string "Created"
|
||||
// @Bind form body
|
||||
func (c *Creator) CreateContent(ctx fiber.Ctx, form *dto.ContentCreateForm) error {
|
||||
return services.Creator.CreateContent(ctx.Context(), form)
|
||||
return services.Creator.CreateContent(ctx, form)
|
||||
}
|
||||
|
||||
// Update content
|
||||
@@ -84,7 +84,7 @@ func (c *Creator) CreateContent(ctx fiber.Ctx, form *dto.ContentCreateForm) erro
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) UpdateContent(ctx fiber.Ctx, id string, form *dto.ContentUpdateForm) error {
|
||||
return services.Creator.UpdateContent(ctx.Context(), id, form)
|
||||
return services.Creator.UpdateContent(ctx, id, form)
|
||||
}
|
||||
|
||||
// Delete content
|
||||
@@ -99,7 +99,7 @@ func (c *Creator) UpdateContent(ctx fiber.Ctx, id string, form *dto.ContentUpdat
|
||||
// @Success 200 {string} string "Deleted"
|
||||
// @Bind id path
|
||||
func (c *Creator) DeleteContent(ctx fiber.Ctx, id string) error {
|
||||
return services.Creator.DeleteContent(ctx.Context(), id)
|
||||
return services.Creator.DeleteContent(ctx, id)
|
||||
}
|
||||
|
||||
// List sales orders
|
||||
@@ -115,7 +115,7 @@ func (c *Creator) DeleteContent(ctx fiber.Ctx, id string) error {
|
||||
// @Success 200 {array} dto.Order
|
||||
// @Bind filter query
|
||||
func (c *Creator) ListOrders(ctx fiber.Ctx, filter *dto.CreatorOrderListFilter) ([]dto.Order, error) {
|
||||
return services.Creator.ListOrders(ctx.Context(), filter)
|
||||
return services.Creator.ListOrders(ctx, filter)
|
||||
}
|
||||
|
||||
// Process refund
|
||||
@@ -132,7 +132,7 @@ func (c *Creator) ListOrders(ctx fiber.Ctx, filter *dto.CreatorOrderListFilter)
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) Refund(ctx fiber.Ctx, id string, form *dto.RefundForm) error {
|
||||
return services.Creator.ProcessRefund(ctx.Context(), id, form)
|
||||
return services.Creator.ProcessRefund(ctx, id, form)
|
||||
}
|
||||
|
||||
// Get channel settings
|
||||
@@ -145,7 +145,7 @@ func (c *Creator) Refund(ctx fiber.Ctx, id string, form *dto.RefundForm) error {
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.Settings
|
||||
func (c *Creator) GetSettings(ctx fiber.Ctx) (*dto.Settings, error) {
|
||||
return services.Creator.GetSettings(ctx.Context())
|
||||
return services.Creator.GetSettings(ctx)
|
||||
}
|
||||
|
||||
// Update channel settings
|
||||
@@ -160,7 +160,7 @@ func (c *Creator) GetSettings(ctx fiber.Ctx) (*dto.Settings, error) {
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind form body
|
||||
func (c *Creator) UpdateSettings(ctx fiber.Ctx, form *dto.Settings) error {
|
||||
return services.Creator.UpdateSettings(ctx.Context(), form)
|
||||
return services.Creator.UpdateSettings(ctx, form)
|
||||
}
|
||||
|
||||
// List payout accounts
|
||||
@@ -173,7 +173,7 @@ func (c *Creator) UpdateSettings(ctx fiber.Ctx, form *dto.Settings) error {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.PayoutAccount
|
||||
func (c *Creator) ListPayoutAccounts(ctx fiber.Ctx) ([]dto.PayoutAccount, error) {
|
||||
return services.Creator.ListPayoutAccounts(ctx.Context())
|
||||
return services.Creator.ListPayoutAccounts(ctx)
|
||||
}
|
||||
|
||||
// Add payout account
|
||||
@@ -188,7 +188,7 @@ func (c *Creator) ListPayoutAccounts(ctx fiber.Ctx) ([]dto.PayoutAccount, error)
|
||||
// @Success 200 {string} string "Added"
|
||||
// @Bind form body
|
||||
func (c *Creator) AddPayoutAccount(ctx fiber.Ctx, form *dto.PayoutAccount) error {
|
||||
return services.Creator.AddPayoutAccount(ctx.Context(), form)
|
||||
return services.Creator.AddPayoutAccount(ctx, form)
|
||||
}
|
||||
|
||||
// Remove payout account
|
||||
@@ -203,7 +203,7 @@ func (c *Creator) AddPayoutAccount(ctx fiber.Ctx, form *dto.PayoutAccount) error
|
||||
// @Success 200 {string} string "Removed"
|
||||
// @Bind id query
|
||||
func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, id string) error {
|
||||
return services.Creator.RemovePayoutAccount(ctx.Context(), id)
|
||||
return services.Creator.RemovePayoutAccount(ctx, id)
|
||||
}
|
||||
|
||||
// Request withdrawal
|
||||
@@ -218,5 +218,5 @@ func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, id string) error {
|
||||
// @Success 200 {string} string "Withdrawal requested"
|
||||
// @Bind form body
|
||||
func (c *Creator) Withdraw(ctx fiber.Ctx, form *dto.WithdrawForm) error {
|
||||
return services.Creator.Withdraw(ctx.Context(), form)
|
||||
return services.Creator.Withdraw(ctx, form)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Tenant struct{}
|
||||
// @Success 200 {object} dto.TenantProfile
|
||||
// @Bind id path
|
||||
func (t *Tenant) Get(ctx fiber.Ctx, id string) (*dto.TenantProfile, error) {
|
||||
return services.Tenant.GetPublicProfile(ctx.Context(), id)
|
||||
return services.Tenant.GetPublicProfile(ctx, id)
|
||||
}
|
||||
|
||||
// Follow a tenant
|
||||
@@ -37,7 +37,7 @@ func (t *Tenant) Get(ctx fiber.Ctx, id string) (*dto.TenantProfile, error) {
|
||||
// @Success 200 {string} string "Followed"
|
||||
// @Bind id path
|
||||
func (t *Tenant) Follow(ctx fiber.Ctx, id string) error {
|
||||
return services.Tenant.Follow(ctx.Context(), id)
|
||||
return services.Tenant.Follow(ctx, id)
|
||||
}
|
||||
|
||||
// Unfollow a tenant
|
||||
@@ -52,5 +52,5 @@ func (t *Tenant) Follow(ctx fiber.Ctx, id string) error {
|
||||
// @Success 200 {string} string "Unfollowed"
|
||||
// @Bind id path
|
||||
func (t *Tenant) Unfollow(ctx fiber.Ctx, id string) error {
|
||||
return services.Tenant.Unfollow(ctx.Context(), id)
|
||||
return services.Tenant.Unfollow(ctx, id)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type Transaction struct{}
|
||||
// @Success 200 {object} dto.OrderCreateResponse
|
||||
// @Bind form body
|
||||
func (t *Transaction) Create(ctx fiber.Ctx, form *dto.OrderCreateForm) (*dto.OrderCreateResponse, error) {
|
||||
return services.Order.Create(ctx.Context(), form)
|
||||
return services.Order.Create(ctx, form)
|
||||
}
|
||||
|
||||
// Pay for order
|
||||
@@ -39,7 +39,7 @@ func (t *Transaction) Create(ctx fiber.Ctx, form *dto.OrderCreateForm) (*dto.Ord
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (t *Transaction) Pay(ctx fiber.Ctx, id string, form *dto.OrderPayForm) (*dto.OrderPayResponse, error) {
|
||||
return services.Order.Pay(ctx.Context(), id, form)
|
||||
return services.Order.Pay(ctx, id, form)
|
||||
}
|
||||
|
||||
// Check order payment status
|
||||
@@ -54,7 +54,7 @@ func (t *Transaction) Pay(ctx fiber.Ctx, id string, form *dto.OrderPayForm) (*dt
|
||||
// @Success 200 {object} dto.OrderStatusResponse
|
||||
// @Bind id path
|
||||
func (t *Transaction) Status(ctx fiber.Ctx, id string) (*dto.OrderStatusResponse, error) {
|
||||
return services.Order.Status(ctx.Context(), id)
|
||||
return services.Order.Status(ctx, id)
|
||||
}
|
||||
|
||||
type WebhookForm struct {
|
||||
@@ -74,7 +74,7 @@ type WebhookForm struct {
|
||||
// @Success 200 {string} string "success"
|
||||
// @Bind form body
|
||||
func (t *Transaction) Webhook(ctx fiber.Ctx, form *WebhookForm) (string, error) {
|
||||
err := services.Order.ProcessExternalPayment(ctx.Context(), form.OrderID, form.ExternalID)
|
||||
err := services.Order.ProcessExternalPayment(ctx, form.OrderID, form.ExternalID)
|
||||
if err != nil {
|
||||
return "fail", err
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ type User struct{}
|
||||
// @Produce json
|
||||
// @Success 200 {object} auth_dto.User
|
||||
func (u *User) Me(ctx fiber.Ctx) (*auth_dto.User, error) {
|
||||
return services.User.Me(ctx.Context())
|
||||
return services.User.Me(ctx)
|
||||
}
|
||||
|
||||
// Update user profile
|
||||
@@ -37,7 +37,7 @@ func (u *User) Me(ctx fiber.Ctx) (*auth_dto.User, error) {
|
||||
// @Success 200 {string} string "Updated"
|
||||
// @Bind form body
|
||||
func (u *User) Update(ctx fiber.Ctx, form *dto.UserUpdate) error {
|
||||
return services.User.Update(ctx.Context(), form)
|
||||
return services.User.Update(ctx, form)
|
||||
}
|
||||
|
||||
// Submit real-name authentication
|
||||
@@ -52,7 +52,7 @@ func (u *User) Update(ctx fiber.Ctx, form *dto.UserUpdate) error {
|
||||
// @Success 200 {string} string "Submitted"
|
||||
// @Bind form body
|
||||
func (u *User) RealName(ctx fiber.Ctx, form *dto.RealNameForm) error {
|
||||
return services.User.RealName(ctx.Context(), form)
|
||||
return services.User.RealName(ctx, form)
|
||||
}
|
||||
|
||||
// Get wallet balance and transactions
|
||||
@@ -65,7 +65,7 @@ func (u *User) RealName(ctx fiber.Ctx, form *dto.RealNameForm) error {
|
||||
// @Produce json
|
||||
// @Success 200 {object} dto.WalletResponse
|
||||
func (u *User) Wallet(ctx fiber.Ctx) (*dto.WalletResponse, error) {
|
||||
return services.Wallet.GetWallet(ctx.Context())
|
||||
return services.Wallet.GetWallet(ctx)
|
||||
}
|
||||
|
||||
// Recharge wallet
|
||||
@@ -80,7 +80,7 @@ func (u *User) Wallet(ctx fiber.Ctx) (*dto.WalletResponse, error) {
|
||||
// @Success 200 {object} dto.RechargeResponse
|
||||
// @Bind form body
|
||||
func (u *User) Recharge(ctx fiber.Ctx, form *dto.RechargeForm) (*dto.RechargeResponse, error) {
|
||||
return services.Wallet.Recharge(ctx.Context(), form)
|
||||
return services.Wallet.Recharge(ctx, form)
|
||||
}
|
||||
|
||||
// List user orders
|
||||
@@ -95,7 +95,7 @@ func (u *User) Recharge(ctx fiber.Ctx, form *dto.RechargeForm) (*dto.RechargeRes
|
||||
// @Success 200 {array} dto.Order
|
||||
// @Bind status query
|
||||
func (u *User) ListOrders(ctx fiber.Ctx, status string) ([]dto.Order, error) {
|
||||
return services.Order.ListUserOrders(ctx.Context(), status)
|
||||
return services.Order.ListUserOrders(ctx, status)
|
||||
}
|
||||
|
||||
// Get user order detail
|
||||
@@ -110,7 +110,7 @@ func (u *User) ListOrders(ctx fiber.Ctx, status string) ([]dto.Order, error) {
|
||||
// @Success 200 {object} dto.Order
|
||||
// @Bind id path
|
||||
func (u *User) GetOrder(ctx fiber.Ctx, id string) (*dto.Order, error) {
|
||||
return services.Order.GetUserOrder(ctx.Context(), id)
|
||||
return services.Order.GetUserOrder(ctx, id)
|
||||
}
|
||||
|
||||
// Get purchased content
|
||||
@@ -123,7 +123,7 @@ func (u *User) GetOrder(ctx fiber.Ctx, id string) (*dto.Order, error) {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.ContentItem
|
||||
func (u *User) Library(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
return services.Content.GetLibrary(ctx.Context())
|
||||
return services.Content.GetLibrary(ctx)
|
||||
}
|
||||
|
||||
// Get favorites
|
||||
@@ -136,7 +136,7 @@ func (u *User) Library(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.ContentItem
|
||||
func (u *User) Favorites(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
return services.Content.GetFavorites(ctx.Context())
|
||||
return services.Content.GetFavorites(ctx)
|
||||
}
|
||||
|
||||
// Add to favorites
|
||||
@@ -151,7 +151,7 @@ func (u *User) Favorites(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
// @Success 200 {string} string "Added"
|
||||
// @Bind contentId query
|
||||
func (u *User) AddFavorite(ctx fiber.Ctx, contentId string) error {
|
||||
return services.Content.AddFavorite(ctx.Context(), contentId)
|
||||
return services.Content.AddFavorite(ctx, contentId)
|
||||
}
|
||||
|
||||
// Remove from favorites
|
||||
@@ -166,7 +166,7 @@ func (u *User) AddFavorite(ctx fiber.Ctx, contentId string) error {
|
||||
// @Success 200 {string} string "Removed"
|
||||
// @Bind contentId path
|
||||
func (u *User) RemoveFavorite(ctx fiber.Ctx, contentId string) error {
|
||||
return services.Content.RemoveFavorite(ctx.Context(), contentId)
|
||||
return services.Content.RemoveFavorite(ctx, contentId)
|
||||
}
|
||||
|
||||
// Get liked contents
|
||||
@@ -179,7 +179,7 @@ func (u *User) RemoveFavorite(ctx fiber.Ctx, contentId string) error {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.ContentItem
|
||||
func (u *User) Likes(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
return services.Content.GetLikes(ctx.Context())
|
||||
return services.Content.GetLikes(ctx)
|
||||
}
|
||||
|
||||
// Like content
|
||||
@@ -194,7 +194,7 @@ func (u *User) Likes(ctx fiber.Ctx) ([]dto.ContentItem, error) {
|
||||
// @Success 200 {string} string "Liked"
|
||||
// @Bind contentId query
|
||||
func (u *User) AddLike(ctx fiber.Ctx, contentId string) error {
|
||||
return services.Content.AddLike(ctx.Context(), contentId)
|
||||
return services.Content.AddLike(ctx, contentId)
|
||||
}
|
||||
|
||||
// Unlike content
|
||||
@@ -209,7 +209,7 @@ func (u *User) AddLike(ctx fiber.Ctx, contentId string) error {
|
||||
// @Success 200 {string} string "Unliked"
|
||||
// @Bind contentId path
|
||||
func (u *User) RemoveLike(ctx fiber.Ctx, contentId string) error {
|
||||
return services.Content.RemoveLike(ctx.Context(), contentId)
|
||||
return services.Content.RemoveLike(ctx, contentId)
|
||||
}
|
||||
|
||||
// Get following tenants
|
||||
@@ -222,7 +222,7 @@ func (u *User) RemoveLike(ctx fiber.Ctx, contentId string) error {
|
||||
// @Produce json
|
||||
// @Success 200 {array} dto.TenantProfile
|
||||
func (u *User) Following(ctx fiber.Ctx) ([]dto.TenantProfile, error) {
|
||||
return services.Tenant.ListFollowed(ctx.Context())
|
||||
return services.Tenant.ListFollowed(ctx)
|
||||
}
|
||||
|
||||
// Get notifications
|
||||
@@ -239,7 +239,7 @@ func (u *User) Following(ctx fiber.Ctx) ([]dto.TenantProfile, error) {
|
||||
// @Bind typeArg query key(type)
|
||||
// @Bind page query
|
||||
func (u *User) Notifications(ctx fiber.Ctx, typeArg string, page int) (*requests.Pager, error) {
|
||||
return services.Notification.List(ctx.Context(), page, typeArg)
|
||||
return services.Notification.List(ctx, page, typeArg)
|
||||
}
|
||||
|
||||
// List my coupons
|
||||
@@ -254,5 +254,5 @@ func (u *User) Notifications(ctx fiber.Ctx, typeArg string, page int) (*requests
|
||||
// @Success 200 {array} dto.UserCouponItem
|
||||
// @Bind status query
|
||||
func (u *User) MyCoupons(ctx fiber.Ctx, status string) ([]dto.UserCouponItem, error) {
|
||||
return services.Coupon.ListUserCoupons(ctx.Context(), status)
|
||||
return services.Coupon.ListUserCoupons(ctx, status)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user