tenant: add invites and join requests
This commit is contained in:
@@ -603,6 +603,342 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/invites": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "邀请码列表(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Code 按邀请码模糊过滤(可选):支持部分匹配(like)。",
|
||||
"name": "code",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit is page size; only values in {10,20,50,100} are accepted (otherwise defaults to 10).",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Page is 1-based page index; values \u003c= 0 are normalized to 1.",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"active",
|
||||
"disabled",
|
||||
"expired"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"TenantInviteStatusActive",
|
||||
"TenantInviteStatusDisabled",
|
||||
"TenantInviteStatusExpired"
|
||||
],
|
||||
"description": "Status 按状态过滤(可选):active/disabled/expired。",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/requests.Pager"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.TenantInvite"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "创建邀请码(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.AdminTenantInviteCreateForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantInvite"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/invites/{inviteID}/disable": {
|
||||
"patch": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "禁用邀请码(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "InviteID",
|
||||
"name": "inviteID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.AdminTenantInviteDisableForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantInvite"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/join-requests": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "加入申请列表(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Limit is page size; only values in {10,20,50,100} are accepted (otherwise defaults to 10).",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Page is 1-based page index; values \u003c= 0 are normalized to 1.",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"pending",
|
||||
"approved",
|
||||
"rejected"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"TenantJoinRequestStatusPending",
|
||||
"TenantJoinRequestStatusApproved",
|
||||
"TenantJoinRequestStatusRejected"
|
||||
],
|
||||
"description": "Status 按申请状态过滤(可选):pending/approved/rejected。",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID 按申请人用户ID过滤(可选)。",
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/requests.Pager"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"$ref": "#/definitions/models.TenantJoinRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/join-requests/{requestID}/approve": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "通过加入申请(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "RequestID",
|
||||
"name": "requestID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.AdminTenantJoinRequestDecideForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantJoinRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/join-requests/{requestID}/reject": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "拒绝加入申请(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "RequestID",
|
||||
"name": "requestID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.AdminTenantJoinRequestDecideForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantJoinRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/orders": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
@@ -849,11 +1185,33 @@ const docTemplate = `{
|
||||
"name": "role",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"pending_verify",
|
||||
"verified",
|
||||
"banned"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"UserStatusPendingVerify",
|
||||
"UserStatusVerified",
|
||||
"UserStatusBanned"
|
||||
],
|
||||
"description": "Status 按成员状态过滤(可选):pending_verify/verified/banned。",
|
||||
"name": "status",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "UserID 按用户ID过滤(可选)。",
|
||||
"name": "user_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Username 按用户名模糊查询(可选,支持包含匹配)。",
|
||||
"name": "username",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@@ -878,6 +1236,45 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/users/{userID}": {
|
||||
"delete": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Tenant"
|
||||
],
|
||||
"summary": "移除租户成员(租户管理)",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "UserID",
|
||||
"name": "userID",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/requests.Pager"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/admin/users/{userID}/join": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
@@ -1239,6 +1636,86 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/join/invite": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"TenantJoin"
|
||||
],
|
||||
"summary": "通过邀请码加入租户",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.JoinByInviteForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantUser"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/join/request": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"TenantJoin"
|
||||
],
|
||||
"summary": "提交加入租户申请",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Tenant Code",
|
||||
"name": "tenantCode",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "Form",
|
||||
"name": "form",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/dto.JoinRequestCreateForm"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.TenantJoinRequest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/t/{tenantCode}/v1/me": {
|
||||
"get": {
|
||||
"consumes": [
|
||||
@@ -1629,6 +2106,32 @@ const docTemplate = `{
|
||||
"RoleSuperAdmin"
|
||||
]
|
||||
},
|
||||
"consts.TenantInviteStatus": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"active",
|
||||
"disabled",
|
||||
"expired"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TenantInviteStatusActive",
|
||||
"TenantInviteStatusDisabled",
|
||||
"TenantInviteStatusExpired"
|
||||
]
|
||||
},
|
||||
"consts.TenantJoinRequestStatus": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"pending",
|
||||
"approved",
|
||||
"rejected"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"TenantJoinRequestStatusPending",
|
||||
"TenantJoinRequestStatusApproved",
|
||||
"TenantJoinRequestStatusRejected"
|
||||
]
|
||||
},
|
||||
"consts.TenantLedgerType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
@@ -1715,6 +2218,45 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.AdminTenantInviteCreateForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "Code 邀请码(可选):为空时由后端生成;建议只包含数字/字母,便于人工输入。",
|
||||
"type": "string"
|
||||
},
|
||||
"expires_at": {
|
||||
"description": "ExpiresAt 过期时间(可选):为空表示不过期;到期后不可再使用。",
|
||||
"type": "string"
|
||||
},
|
||||
"max_uses": {
|
||||
"description": "MaxUses 最大可使用次数(可选):0 表示不限次数;大于 0 时用尽后自动失效。",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "Remark 备注(可选):用于审计记录生成目的/投放渠道等。",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.AdminTenantInviteDisableForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reason": {
|
||||
"description": "Reason 禁用原因(可选):用于审计与追溯。",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.AdminTenantJoinRequestDecideForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reason": {
|
||||
"description": "Reason 审核说明(可选):用于审计记录通过/拒绝原因。",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.AdminTenantUserItem": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1965,6 +2507,24 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.JoinByInviteForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"invite_code": {
|
||||
"description": "InviteCode 邀请码:由租户管理员生成;用户提交后加入对应租户。",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.JoinRequestCreateForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"reason": {
|
||||
"description": "Reason 申请原因(可选):用于向租户管理员说明申请加入的目的。",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.LoginForm": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -2769,6 +3329,116 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TenantInvite": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"code": {
|
||||
"description": "邀请码:用户加入租户时提交;同一租户内唯一",
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"description": "创建时间:默认 now()",
|
||||
"type": "string"
|
||||
},
|
||||
"disabled_at": {
|
||||
"description": "禁用时间:租户管理员禁用该邀请的时间(UTC)",
|
||||
"type": "string"
|
||||
},
|
||||
"disabled_operator_user_id": {
|
||||
"description": "禁用操作人用户ID:租户管理员(审计用)",
|
||||
"type": "integer"
|
||||
},
|
||||
"expires_at": {
|
||||
"description": "过期时间:到期后不可再使用(UTC);为空表示不过期",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "主键ID:自增",
|
||||
"type": "integer"
|
||||
},
|
||||
"max_uses": {
|
||||
"description": "最大可使用次数:0 表示不限制;\u003e0 时 used_count 达到该值后视为失效",
|
||||
"type": "integer"
|
||||
},
|
||||
"remark": {
|
||||
"description": "备注:生成/禁用原因等(审计用)",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "邀请状态:active/disabled/expired;expired 也可由 expires_at 推导,业务侧需保持一致",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/consts.TenantInviteStatus"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tenant_id": {
|
||||
"description": "租户ID:多租户隔离关键字段;所有查询/写入必须限定 tenant_id",
|
||||
"type": "integer"
|
||||
},
|
||||
"updated_at": {
|
||||
"description": "更新时间:默认 now()",
|
||||
"type": "string"
|
||||
},
|
||||
"used_count": {
|
||||
"description": "已使用次数:每次成功加入时 +1;需事务保证并发下不超发",
|
||||
"type": "integer"
|
||||
},
|
||||
"user_id": {
|
||||
"description": "创建人用户ID:生成邀请码的租户管理员(审计用)",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TenantJoinRequest": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"description": "创建时间:默认 now()",
|
||||
"type": "string"
|
||||
},
|
||||
"decided_at": {
|
||||
"description": "处理时间:审核通过/拒绝时记录(UTC)",
|
||||
"type": "string"
|
||||
},
|
||||
"decided_operator_user_id": {
|
||||
"description": "处理人用户ID:租户管理员(审计用)",
|
||||
"type": "integer"
|
||||
},
|
||||
"decided_reason": {
|
||||
"description": "处理说明:管理员通过/拒绝的原因(可选,审计用)",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "主键ID:自增",
|
||||
"type": "integer"
|
||||
},
|
||||
"reason": {
|
||||
"description": "申请原因:用户填写的加入说明(可选)",
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"description": "申请状态:pending/approved/rejected;状态变更需记录 decided_at 与 decided_operator_user_id",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/consts.TenantJoinRequestStatus"
|
||||
}
|
||||
]
|
||||
},
|
||||
"tenant_id": {
|
||||
"description": "租户ID:多租户隔离关键字段;所有查询/写入必须限定 tenant_id",
|
||||
"type": "integer"
|
||||
},
|
||||
"updated_at": {
|
||||
"description": "更新时间:默认 now()",
|
||||
"type": "string"
|
||||
},
|
||||
"user_id": {
|
||||
"description": "申请人用户ID:发起加入申请的用户",
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.TenantLedger": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Reference in New Issue
Block a user