feat: expand superadmin user detail views

This commit is contained in:
2026-01-15 12:29:52 +08:00
parent 8419ddede7
commit bec984b959
10 changed files with 2874 additions and 12 deletions

View File

@@ -520,6 +520,100 @@ const docTemplate = `{
}
}
},
"/super/v1/tenant-join-requests": {
"get": {
"description": "List tenant join requests across tenants",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "List tenant join requests",
"parameters": [
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperTenantJoinRequestItem"
}
}
}
}
]
}
}
}
}
},
"/super/v1/tenant-join-requests/{id}/review": {
"post": {
"description": "Approve or reject a tenant join request",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "Review tenant join request",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Join request ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Review form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantJoinReviewForm"
}
}
],
"responses": {
"200": {
"description": "Reviewed",
"schema": {
"type": "string"
}
}
}
}
},
"/super/v1/tenants": {
"get": {
"description": "List tenants",
@@ -913,6 +1007,229 @@ const docTemplate = `{
}
}
},
"/super/v1/tenants/{tenantID}/coupons": {
"post": {
"description": "Create coupon for tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Coupon"
],
"summary": "Create coupon",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "tenantID",
"in": "path",
"required": true
},
{
"description": "Create form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CouponCreateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CouponItem"
}
}
}
}
},
"/super/v1/tenants/{tenantID}/coupons/{id}": {
"get": {
"description": "Get coupon detail",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Coupon"
],
"summary": "Get coupon",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "tenantID",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "Coupon ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CouponItem"
}
}
}
},
"put": {
"description": "Update coupon for tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Coupon"
],
"summary": "Update coupon",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "tenantID",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "Coupon ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Update form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CouponUpdateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.CouponItem"
}
}
}
}
},
"/super/v1/tenants/{tenantID}/coupons/{id}/grant": {
"post": {
"description": "Grant coupon to users",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Coupon"
],
"summary": "Grant coupon",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "tenantID",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "Coupon ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Grant form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.CouponGrantForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperCouponGrantResponse"
}
}
}
}
},
"/super/v1/tenants/{tenantID}/invites": {
"post": {
"description": "Create tenant invite code",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Tenant"
],
"summary": "Create tenant invite",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "tenantID",
"in": "path",
"required": true
},
{
"description": "Invite form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantInviteCreateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.TenantInviteItem"
}
}
}
}
},
"/super/v1/tenants/{tenantID}/users": {
"get": {
"description": "List tenant users",
@@ -1116,6 +1433,159 @@ const docTemplate = `{
}
}
},
"/super/v1/users/{id}/coupons": {
"get": {
"description": "List coupons of a user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "List user coupons",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperUserCouponItem"
}
}
}
}
]
}
}
}
}
},
"/super/v1/users/{id}/notifications": {
"get": {
"description": "List notifications of a user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "List user notifications",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"description": "Page size",
"name": "limit",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/requests.Pager"
},
{
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.SuperUserNotificationItem"
}
}
}
}
]
}
}
}
}
},
"/super/v1/users/{id}/realname": {
"get": {
"description": "Get real-name verification detail of a user",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "Get user real-name verification detail",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "User ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.SuperUserRealNameResponse"
}
}
}
}
},
"/super/v1/users/{id}/roles": {
"patch": {
"description": "Update user roles",
@@ -4279,6 +4749,19 @@ const docTemplate = `{
"TenantUserRoleTenantAdmin"
]
},
"consts.UserCouponStatus": {
"type": "string",
"enum": [
"unused",
"used",
"expired"
],
"x-enum-varnames": [
"UserCouponStatusUnused",
"UserCouponStatusUsed",
"UserCouponStatusExpired"
]
},
"consts.UserStatus": {
"type": "string",
"enum": [
@@ -5635,6 +6118,15 @@ const docTemplate = `{
}
}
},
"dto.SuperCouponGrantResponse": {
"type": "object",
"properties": {
"granted": {
"description": "Granted 实际发放数量。",
"type": "integer"
}
}
},
"dto.SuperCouponItem": {
"type": "object",
"properties": {
@@ -5922,6 +6414,67 @@ const docTemplate = `{
}
}
},
"dto.SuperTenantJoinRequestItem": {
"type": "object",
"properties": {
"created_at": {
"description": "CreatedAt 申请时间RFC3339。",
"type": "string"
},
"decided_at": {
"description": "DecidedAt 审核时间RFC3339。",
"type": "string"
},
"decided_operator_user_id": {
"description": "DecidedOperatorUserID 审核操作者ID。",
"type": "integer"
},
"decided_reason": {
"description": "DecidedReason 审核备注/原因。",
"type": "string"
},
"id": {
"description": "ID 申请记录ID。",
"type": "integer"
},
"reason": {
"description": "Reason 申请说明。",
"type": "string"
},
"status": {
"description": "Status 申请状态。",
"type": "string"
},
"status_description": {
"description": "StatusDescription 状态描述(用于展示)。",
"type": "string"
},
"tenant_code": {
"description": "TenantCode 租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 租户名称。",
"type": "string"
},
"updated_at": {
"description": "UpdatedAt 更新时间RFC3339。",
"type": "string"
},
"user_id": {
"description": "UserID 申请用户ID。",
"type": "integer"
},
"username": {
"description": "Username 申请用户名称。",
"type": "string"
}
}
},
"dto.SuperTenantUserItem": {
"type": "object",
"properties": {
@@ -5943,6 +6496,95 @@ const docTemplate = `{
}
}
},
"dto.SuperUserCouponItem": {
"type": "object",
"properties": {
"coupon_id": {
"description": "CouponID 券模板ID。",
"type": "integer"
},
"created_at": {
"description": "CreatedAt 领取时间RFC3339。",
"type": "string"
},
"description": {
"description": "Description 券描述。",
"type": "string"
},
"end_at": {
"description": "EndAt 过期时间RFC3339。",
"type": "string"
},
"id": {
"description": "ID 用户券ID。",
"type": "integer"
},
"max_discount": {
"description": "MaxDiscount 折扣券最高抵扣金额(分)。",
"type": "integer"
},
"min_order_amount": {
"description": "MinOrderAmount 使用门槛金额(分)。",
"type": "integer"
},
"order_id": {
"description": "OrderID 使用订单ID未使用为0。",
"type": "integer"
},
"start_at": {
"description": "StartAt 生效时间RFC3339。",
"type": "string"
},
"status": {
"description": "Status 用户券状态。",
"allOf": [
{
"$ref": "#/definitions/consts.UserCouponStatus"
}
]
},
"status_description": {
"description": "StatusDescription 用户券状态描述(用于展示)。",
"type": "string"
},
"tenant_code": {
"description": "TenantCode 券所属租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 券所属租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 券所属租户名称。",
"type": "string"
},
"title": {
"description": "Title 券标题。",
"type": "string"
},
"type": {
"description": "Type 券类型。",
"allOf": [
{
"$ref": "#/definitions/consts.CouponType"
}
]
},
"type_description": {
"description": "TypeDescription 券类型描述(用于展示)。",
"type": "string"
},
"used_at": {
"description": "UsedAt 使用时间RFC3339。",
"type": "string"
},
"value": {
"description": "Value 券面值/折扣值。",
"type": "integer"
}
}
},
"dto.SuperUserLite": {
"type": "object",
"properties": {
@@ -5987,6 +6629,68 @@ const docTemplate = `{
}
}
},
"dto.SuperUserNotificationItem": {
"type": "object",
"properties": {
"content": {
"description": "Content 通知内容。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 发送时间RFC3339。",
"type": "string"
},
"id": {
"description": "ID 通知ID。",
"type": "integer"
},
"read": {
"description": "Read 是否已读。",
"type": "boolean"
},
"tenant_code": {
"description": "TenantCode 通知所属租户编码。",
"type": "string"
},
"tenant_id": {
"description": "TenantID 通知所属租户ID。",
"type": "integer"
},
"tenant_name": {
"description": "TenantName 通知所属租户名称。",
"type": "string"
},
"title": {
"description": "Title 通知标题。",
"type": "string"
},
"type": {
"description": "Type 通知类型。",
"type": "string"
}
}
},
"dto.SuperUserRealNameResponse": {
"type": "object",
"properties": {
"id_card_masked": {
"description": "IDCardMasked 身份证号脱敏展示。",
"type": "string"
},
"is_real_name_verified": {
"description": "IsRealNameVerified 是否已实名认证。",
"type": "boolean"
},
"real_name": {
"description": "RealName 真实姓名(来自用户元数据)。",
"type": "string"
},
"verified_at": {
"description": "VerifiedAt 实名认证时间RFC3339。",
"type": "string"
}
}
},
"dto.SuperWalletResponse": {
"type": "object",
"properties": {