feat: add superadmin member review and coupon ops

This commit is contained in:
2026-01-15 11:53:52 +08:00
parent 56082bad4f
commit 8419ddede7
11 changed files with 1254 additions and 96 deletions

View File

@@ -2,8 +2,10 @@ package v1
import (
dto "quyun/v2/app/http/super/v1/dto"
v1_dto "quyun/v2/app/http/v1/dto"
"quyun/v2/app/requests"
"quyun/v2/app/services"
"quyun/v2/database/models"
"github.com/gofiber/fiber/v3"
)
@@ -62,6 +64,57 @@ func (c *tenants) ListUsers(ctx fiber.Ctx, tenantID int64, filter *dto.SuperTena
return services.Super.ListTenantUsers(ctx, tenantID, filter)
}
// List tenant join requests
//
// @Router /super/v1/tenant-join-requests [get]
// @Summary List tenant join requests
// @Description List tenant join requests across tenants
// @Tags Tenant
// @Accept json
// @Produce json
// @Param page query int false "Page number"
// @Param limit query int false "Page size"
// @Success 200 {object} requests.Pager{items=[]dto.SuperTenantJoinRequestItem}
// @Bind filter query
func (c *tenants) ListJoinRequests(ctx fiber.Ctx, filter *dto.SuperTenantJoinRequestListFilter) (*requests.Pager, error) {
return services.Super.ListTenantJoinRequests(ctx, filter)
}
// Review tenant join request
//
// @Router /super/v1/tenant-join-requests/:id<int>/review [post]
// @Summary Review tenant join request
// @Description Approve or reject a tenant join request
// @Tags Tenant
// @Accept json
// @Produce json
// @Param id path int64 true "Join request ID"
// @Param form body v1_dto.TenantJoinReviewForm true "Review form"
// @Success 200 {string} string "Reviewed"
// @Bind user local key(__ctx_user)
// @Bind id path
// @Bind form body
func (c *tenants) ReviewJoinRequest(ctx fiber.Ctx, user *models.User, id int64, form *v1_dto.TenantJoinReviewForm) error {
return services.Super.ReviewTenantJoinRequest(ctx, user.ID, id, form)
}
// Create tenant invite
//
// @Router /super/v1/tenants/:tenantID<int>/invites [post]
// @Summary Create tenant invite
// @Description Create tenant invite code
// @Tags Tenant
// @Accept json
// @Produce json
// @Param tenantID path int64 true "Tenant ID"
// @Param form body v1_dto.TenantInviteCreateForm true "Invite form"
// @Success 200 {object} v1_dto.TenantInviteItem
// @Bind tenantID path
// @Bind form body
func (c *tenants) CreateInvite(ctx fiber.Ctx, tenantID int64, form *v1_dto.TenantInviteCreateForm) (*v1_dto.TenantInviteItem, error) {
return services.Super.CreateTenantInvite(ctx, tenantID, form)
}
// Create tenant
//
// @Router /super/v1/tenants [post]