refactor: 移除不必要的上下文调用,简化服务方法参数
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user