feat: tenant-scoped routing and portal navigation
This commit is contained in:
@@ -14,7 +14,7 @@ type Creator struct{}
|
||||
|
||||
// Apply to become a creator
|
||||
//
|
||||
// @Router /v1/creator/apply [post]
|
||||
// @Router /t/:tenantCode/v1/creator/apply [post]
|
||||
// @Summary Apply creator
|
||||
// @Description Apply to become a creator
|
||||
// @Tags CreatorCenter
|
||||
@@ -25,12 +25,13 @@ type Creator struct{}
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *Creator) Apply(ctx fiber.Ctx, user *models.User, form *dto.ApplyForm) error {
|
||||
return services.Creator.Apply(ctx, user.ID, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.Apply(ctx, tenantID, user.ID, form)
|
||||
}
|
||||
|
||||
// Get creator dashboard stats
|
||||
//
|
||||
// @Router /v1/creator/dashboard [get]
|
||||
// @Router /t/:tenantCode/v1/creator/dashboard [get]
|
||||
// @Summary Dashboard stats
|
||||
// @Description Get creator dashboard stats
|
||||
// @Tags CreatorCenter
|
||||
@@ -39,12 +40,13 @@ func (c *Creator) Apply(ctx fiber.Ctx, user *models.User, form *dto.ApplyForm) e
|
||||
// @Success 200 {object} dto.DashboardStats
|
||||
// @Bind user local key(__ctx_user)
|
||||
func (c *Creator) Dashboard(ctx fiber.Ctx, user *models.User) (*dto.DashboardStats, error) {
|
||||
return services.Creator.Dashboard(ctx, user.ID)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.Dashboard(ctx, tenantID, user.ID)
|
||||
}
|
||||
|
||||
// Get content details for edit
|
||||
//
|
||||
// @Router /v1/creator/contents/:id<int> [get]
|
||||
// @Router /t/:tenantCode/v1/creator/contents/:id<int> [get]
|
||||
// @Summary Get content
|
||||
// @Description Get content details for edit
|
||||
// @Tags CreatorCenter
|
||||
@@ -55,12 +57,13 @@ func (c *Creator) Dashboard(ctx fiber.Ctx, user *models.User) (*dto.DashboardSta
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (c *Creator) GetContent(ctx fiber.Ctx, user *models.User, id int64) (*dto.ContentEditDTO, error) {
|
||||
return services.Creator.GetContent(ctx, user.ID, id)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.GetContent(ctx, tenantID, user.ID, id)
|
||||
}
|
||||
|
||||
// List creator contents
|
||||
//
|
||||
// @Router /v1/creator/contents [get]
|
||||
// @Router /t/:tenantCode/v1/creator/contents [get]
|
||||
// @Summary List contents
|
||||
// @Description List creator contents
|
||||
// @Tags CreatorCenter
|
||||
@@ -77,12 +80,13 @@ func (c *Creator) ListContents(
|
||||
user *models.User,
|
||||
filter *dto.CreatorContentListFilter,
|
||||
) (*requests.Pager, error) {
|
||||
return services.Creator.ListContents(ctx, user.ID, filter)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.ListContents(ctx, tenantID, user.ID, filter)
|
||||
}
|
||||
|
||||
// Create/Publish content
|
||||
//
|
||||
// @Router /v1/creator/contents [post]
|
||||
// @Router /t/:tenantCode/v1/creator/contents [post]
|
||||
// @Summary Create content
|
||||
// @Description Create/Publish content
|
||||
// @Tags CreatorCenter
|
||||
@@ -93,12 +97,13 @@ func (c *Creator) ListContents(
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *Creator) CreateContent(ctx fiber.Ctx, user *models.User, form *dto.ContentCreateForm) error {
|
||||
return services.Creator.CreateContent(ctx, user.ID, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.CreateContent(ctx, tenantID, user.ID, form)
|
||||
}
|
||||
|
||||
// Update content
|
||||
//
|
||||
// @Router /v1/creator/contents/:id<int> [put]
|
||||
// @Router /t/:tenantCode/v1/creator/contents/:id<int> [put]
|
||||
// @Summary Update content
|
||||
// @Description Update content
|
||||
// @Tags CreatorCenter
|
||||
@@ -111,12 +116,13 @@ func (c *Creator) CreateContent(ctx fiber.Ctx, user *models.User, form *dto.Cont
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) UpdateContent(ctx fiber.Ctx, user *models.User, id int64, form *dto.ContentUpdateForm) error {
|
||||
return services.Creator.UpdateContent(ctx, user.ID, id, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.UpdateContent(ctx, tenantID, user.ID, id, form)
|
||||
}
|
||||
|
||||
// Delete content
|
||||
//
|
||||
// @Router /v1/creator/contents/:id<int> [delete]
|
||||
// @Router /t/:tenantCode/v1/creator/contents/:id<int> [delete]
|
||||
// @Summary Delete content
|
||||
// @Description Delete content
|
||||
// @Tags CreatorCenter
|
||||
@@ -127,12 +133,13 @@ func (c *Creator) UpdateContent(ctx fiber.Ctx, user *models.User, id int64, form
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id path
|
||||
func (c *Creator) DeleteContent(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Creator.DeleteContent(ctx, user.ID, id)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.DeleteContent(ctx, tenantID, user.ID, id)
|
||||
}
|
||||
|
||||
// List sales orders
|
||||
//
|
||||
// @Router /v1/creator/orders [get]
|
||||
// @Router /t/:tenantCode/v1/creator/orders [get]
|
||||
// @Summary List sales orders
|
||||
// @Description List sales orders
|
||||
// @Tags CreatorCenter
|
||||
@@ -148,12 +155,13 @@ func (c *Creator) ListOrders(
|
||||
user *models.User,
|
||||
filter *dto.CreatorOrderListFilter,
|
||||
) ([]dto.Order, error) {
|
||||
return services.Creator.ListOrders(ctx, user.ID, filter)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.ListOrders(ctx, tenantID, user.ID, filter)
|
||||
}
|
||||
|
||||
// Process refund
|
||||
//
|
||||
// @Router /v1/creator/orders/:id<int>/refund [post]
|
||||
// @Router /t/:tenantCode/v1/creator/orders/:id<int>/refund [post]
|
||||
// @Summary Process refund
|
||||
// @Description Process refund
|
||||
// @Tags CreatorCenter
|
||||
@@ -166,12 +174,13 @@ func (c *Creator) ListOrders(
|
||||
// @Bind id path
|
||||
// @Bind form body
|
||||
func (c *Creator) Refund(ctx fiber.Ctx, user *models.User, id int64, form *dto.RefundForm) error {
|
||||
return services.Creator.ProcessRefund(ctx, user.ID, id, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.ProcessRefund(ctx, tenantID, user.ID, id, form)
|
||||
}
|
||||
|
||||
// Get channel settings
|
||||
//
|
||||
// @Router /v1/creator/settings [get]
|
||||
// @Router /t/:tenantCode/v1/creator/settings [get]
|
||||
// @Summary Get settings
|
||||
// @Description Get channel settings
|
||||
// @Tags CreatorCenter
|
||||
@@ -180,12 +189,13 @@ func (c *Creator) Refund(ctx fiber.Ctx, user *models.User, id int64, form *dto.R
|
||||
// @Success 200 {object} dto.Settings
|
||||
// @Bind user local key(__ctx_user)
|
||||
func (c *Creator) GetSettings(ctx fiber.Ctx, user *models.User) (*dto.Settings, error) {
|
||||
return services.Creator.GetSettings(ctx, user.ID)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.GetSettings(ctx, tenantID, user.ID)
|
||||
}
|
||||
|
||||
// Update channel settings
|
||||
//
|
||||
// @Router /v1/creator/settings [put]
|
||||
// @Router /t/:tenantCode/v1/creator/settings [put]
|
||||
// @Summary Update settings
|
||||
// @Description Update channel settings
|
||||
// @Tags CreatorCenter
|
||||
@@ -196,12 +206,13 @@ func (c *Creator) GetSettings(ctx fiber.Ctx, user *models.User) (*dto.Settings,
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *Creator) UpdateSettings(ctx fiber.Ctx, user *models.User, form *dto.Settings) error {
|
||||
return services.Creator.UpdateSettings(ctx, user.ID, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.UpdateSettings(ctx, tenantID, user.ID, form)
|
||||
}
|
||||
|
||||
// List payout accounts
|
||||
//
|
||||
// @Router /v1/creator/payout-accounts [get]
|
||||
// @Router /t/:tenantCode/v1/creator/payout-accounts [get]
|
||||
// @Summary List payout accounts
|
||||
// @Description List payout accounts
|
||||
// @Tags CreatorCenter
|
||||
@@ -210,12 +221,13 @@ func (c *Creator) UpdateSettings(ctx fiber.Ctx, user *models.User, form *dto.Set
|
||||
// @Success 200 {array} dto.PayoutAccount
|
||||
// @Bind user local key(__ctx_user)
|
||||
func (c *Creator) ListPayoutAccounts(ctx fiber.Ctx, user *models.User) ([]dto.PayoutAccount, error) {
|
||||
return services.Creator.ListPayoutAccounts(ctx, user.ID)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.ListPayoutAccounts(ctx, tenantID, user.ID)
|
||||
}
|
||||
|
||||
// Add payout account
|
||||
//
|
||||
// @Router /v1/creator/payout-accounts [post]
|
||||
// @Router /t/:tenantCode/v1/creator/payout-accounts [post]
|
||||
// @Summary Add payout account
|
||||
// @Description Add payout account
|
||||
// @Tags CreatorCenter
|
||||
@@ -226,12 +238,13 @@ func (c *Creator) ListPayoutAccounts(ctx fiber.Ctx, user *models.User) ([]dto.Pa
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *Creator) AddPayoutAccount(ctx fiber.Ctx, user *models.User, form *dto.PayoutAccount) error {
|
||||
return services.Creator.AddPayoutAccount(ctx, user.ID, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.AddPayoutAccount(ctx, tenantID, user.ID, form)
|
||||
}
|
||||
|
||||
// Remove payout account
|
||||
//
|
||||
// @Router /v1/creator/payout-accounts [delete]
|
||||
// @Router /t/:tenantCode/v1/creator/payout-accounts [delete]
|
||||
// @Summary Remove payout account
|
||||
// @Description Remove payout account
|
||||
// @Tags CreatorCenter
|
||||
@@ -242,12 +255,13 @@ func (c *Creator) AddPayoutAccount(ctx fiber.Ctx, user *models.User, form *dto.P
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind id query
|
||||
func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, user *models.User, id int64) error {
|
||||
return services.Creator.RemovePayoutAccount(ctx, user.ID, id)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.RemovePayoutAccount(ctx, tenantID, user.ID, id)
|
||||
}
|
||||
|
||||
// Request withdrawal
|
||||
//
|
||||
// @Router /v1/creator/withdraw [post]
|
||||
// @Router /t/:tenantCode/v1/creator/withdraw [post]
|
||||
// @Summary Request withdrawal
|
||||
// @Description Request withdrawal
|
||||
// @Tags CreatorCenter
|
||||
@@ -258,5 +272,6 @@ func (c *Creator) RemovePayoutAccount(ctx fiber.Ctx, user *models.User, id int64
|
||||
// @Bind user local key(__ctx_user)
|
||||
// @Bind form body
|
||||
func (c *Creator) Withdraw(ctx fiber.Ctx, user *models.User, form *dto.WithdrawForm) error {
|
||||
return services.Creator.Withdraw(ctx, user.ID, form)
|
||||
tenantID := getTenantID(ctx)
|
||||
return services.Creator.Withdraw(ctx, tenantID, user.ID, form)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user