feat: add tenant membership flow

This commit is contained in:
2026-01-13 10:26:11 +08:00
parent fa43c0355f
commit 2a670b3a78
11 changed files with 1719 additions and 0 deletions

View File

@@ -1637,6 +1637,82 @@ const docTemplate = `{
}
}
},
"/t/{tenantCode}/v1/creator/members/invite": {
"post": {
"description": "Create an invite for tenant members",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CreatorCenter"
],
"summary": "Create member invite",
"parameters": [
{
"description": "Invite form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantInviteCreateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.TenantInviteItem"
}
}
}
}
},
"/t/{tenantCode}/v1/creator/members/{id}/review": {
"post": {
"description": "Approve or reject a tenant join request",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CreatorCenter"
],
"summary": "Review 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"
}
}
}
}
},
"/t/{tenantCode}/v1/creator/orders": {
"get": {
"description": "List sales orders",
@@ -2895,6 +2971,121 @@ const docTemplate = `{
}
}
},
"/t/{tenantCode}/v1/tenants/{id}/invites/accept": {
"post": {
"description": "Accept a tenant invite by code",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Accept tenant invite",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invite form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantInviteAcceptForm"
}
}
],
"responses": {
"200": {
"description": "Accepted",
"schema": {
"type": "string"
}
}
}
}
},
"/t/{tenantCode}/v1/tenants/{id}/join": {
"post": {
"description": "Submit join request for a tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Apply to join tenant",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Join form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantJoinApplyForm"
}
}
],
"responses": {
"200": {
"description": "Applied",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"description": "Cancel join request for a tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Cancel join request",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Canceled",
"schema": {
"type": "string"
}
}
}
}
},
"/t/{tenantCode}/v1/topics": {
"get": {
"description": "List curated topics",
@@ -4624,6 +4815,69 @@ const docTemplate = `{
}
}
},
"dto.TenantInviteAcceptForm": {
"type": "object",
"properties": {
"code": {
"description": "Code 邀请码(必填)。",
"type": "string"
}
}
},
"dto.TenantInviteCreateForm": {
"type": "object",
"properties": {
"expires_at": {
"description": "ExpiresAt 过期时间RFC3339可选空值使用默认过期时间。",
"type": "string"
},
"max_uses": {
"description": "MaxUses 最大可使用次数(\u003c=0 默认 1。",
"type": "integer"
},
"remark": {
"description": "Remark 备注说明(可选)。",
"type": "string"
}
}
},
"dto.TenantInviteItem": {
"type": "object",
"properties": {
"code": {
"description": "Code 邀请码。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 创建时间RFC3339。",
"type": "string"
},
"expires_at": {
"description": "ExpiresAt 过期时间RFC3339空字符串表示不限制。",
"type": "string"
},
"id": {
"description": "ID 邀请记录ID。",
"type": "integer"
},
"max_uses": {
"description": "MaxUses 最大可使用次数。",
"type": "integer"
},
"remark": {
"description": "Remark 备注说明。",
"type": "string"
},
"status": {
"description": "Status 邀请状态active/disabled/expired。",
"type": "string"
},
"used_count": {
"description": "UsedCount 已使用次数。",
"type": "integer"
}
}
},
"dto.TenantItem": {
"type": "object",
"properties": {
@@ -4710,6 +4964,28 @@ const docTemplate = `{
}
}
},
"dto.TenantJoinApplyForm": {
"type": "object",
"properties": {
"reason": {
"description": "Reason 申请加入原因(可选,空值会使用默认文案)。",
"type": "string"
}
}
},
"dto.TenantJoinReviewForm": {
"type": "object",
"properties": {
"action": {
"description": "Action 审核动作approve/reject。",
"type": "string"
},
"reason": {
"description": "Reason 审核说明(可选,用于展示驳回原因或备注)。",
"type": "string"
}
}
},
"dto.TenantOwnerUserLite": {
"type": "object",
"properties": {

View File

@@ -1631,6 +1631,82 @@
}
}
},
"/t/{tenantCode}/v1/creator/members/invite": {
"post": {
"description": "Create an invite for tenant members",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CreatorCenter"
],
"summary": "Create member invite",
"parameters": [
{
"description": "Invite form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantInviteCreateForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.TenantInviteItem"
}
}
}
}
},
"/t/{tenantCode}/v1/creator/members/{id}/review": {
"post": {
"description": "Approve or reject a tenant join request",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"CreatorCenter"
],
"summary": "Review 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"
}
}
}
}
},
"/t/{tenantCode}/v1/creator/orders": {
"get": {
"description": "List sales orders",
@@ -2889,6 +2965,121 @@
}
}
},
"/t/{tenantCode}/v1/tenants/{id}/invites/accept": {
"post": {
"description": "Accept a tenant invite by code",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Accept tenant invite",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Invite form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantInviteAcceptForm"
}
}
],
"responses": {
"200": {
"description": "Accepted",
"schema": {
"type": "string"
}
}
}
}
},
"/t/{tenantCode}/v1/tenants/{id}/join": {
"post": {
"description": "Submit join request for a tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Apply to join tenant",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Join form",
"name": "form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/dto.TenantJoinApplyForm"
}
}
],
"responses": {
"200": {
"description": "Applied",
"schema": {
"type": "string"
}
}
}
},
"delete": {
"description": "Cancel join request for a tenant",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"TenantPublic"
],
"summary": "Cancel join request",
"parameters": [
{
"type": "integer",
"format": "int64",
"description": "Tenant ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Canceled",
"schema": {
"type": "string"
}
}
}
}
},
"/t/{tenantCode}/v1/topics": {
"get": {
"description": "List curated topics",
@@ -4618,6 +4809,69 @@
}
}
},
"dto.TenantInviteAcceptForm": {
"type": "object",
"properties": {
"code": {
"description": "Code 邀请码(必填)。",
"type": "string"
}
}
},
"dto.TenantInviteCreateForm": {
"type": "object",
"properties": {
"expires_at": {
"description": "ExpiresAt 过期时间RFC3339可选空值使用默认过期时间。",
"type": "string"
},
"max_uses": {
"description": "MaxUses 最大可使用次数(\u003c=0 默认 1。",
"type": "integer"
},
"remark": {
"description": "Remark 备注说明(可选)。",
"type": "string"
}
}
},
"dto.TenantInviteItem": {
"type": "object",
"properties": {
"code": {
"description": "Code 邀请码。",
"type": "string"
},
"created_at": {
"description": "CreatedAt 创建时间RFC3339。",
"type": "string"
},
"expires_at": {
"description": "ExpiresAt 过期时间RFC3339空字符串表示不限制。",
"type": "string"
},
"id": {
"description": "ID 邀请记录ID。",
"type": "integer"
},
"max_uses": {
"description": "MaxUses 最大可使用次数。",
"type": "integer"
},
"remark": {
"description": "Remark 备注说明。",
"type": "string"
},
"status": {
"description": "Status 邀请状态active/disabled/expired。",
"type": "string"
},
"used_count": {
"description": "UsedCount 已使用次数。",
"type": "integer"
}
}
},
"dto.TenantItem": {
"type": "object",
"properties": {
@@ -4704,6 +4958,28 @@
}
}
},
"dto.TenantJoinApplyForm": {
"type": "object",
"properties": {
"reason": {
"description": "Reason 申请加入原因(可选,空值会使用默认文案)。",
"type": "string"
}
}
},
"dto.TenantJoinReviewForm": {
"type": "object",
"properties": {
"action": {
"description": "Action 审核动作approve/reject。",
"type": "string"
},
"reason": {
"description": "Reason 审核说明(可选,用于展示驳回原因或备注)。",
"type": "string"
}
}
},
"dto.TenantOwnerUserLite": {
"type": "object",
"properties": {

View File

@@ -1015,6 +1015,51 @@ definitions:
required:
- duration
type: object
dto.TenantInviteAcceptForm:
properties:
code:
description: Code 邀请码(必填)。
type: string
type: object
dto.TenantInviteCreateForm:
properties:
expires_at:
description: ExpiresAt 过期时间RFC3339可选空值使用默认过期时间
type: string
max_uses:
description: MaxUses 最大可使用次数(<=0 默认 1
type: integer
remark:
description: Remark 备注说明(可选)。
type: string
type: object
dto.TenantInviteItem:
properties:
code:
description: Code 邀请码。
type: string
created_at:
description: CreatedAt 创建时间RFC3339
type: string
expires_at:
description: ExpiresAt 过期时间RFC3339空字符串表示不限制
type: string
id:
description: ID 邀请记录ID。
type: integer
max_uses:
description: MaxUses 最大可使用次数。
type: integer
remark:
description: Remark 备注说明。
type: string
status:
description: Status 邀请状态active/disabled/expired
type: string
used_count:
description: UsedCount 已使用次数。
type: integer
type: object
dto.TenantItem:
properties:
admin_users:
@@ -1074,6 +1119,21 @@ definitions:
description: UUID 租户UUID。
type: string
type: object
dto.TenantJoinApplyForm:
properties:
reason:
description: Reason 申请加入原因(可选,空值会使用默认文案)。
type: string
type: object
dto.TenantJoinReviewForm:
properties:
action:
description: Action 审核动作approve/reject
type: string
reason:
description: Reason 审核说明(可选,用于展示驳回原因或备注)。
type: string
type: object
dto.TenantOwnerUserLite:
properties:
id:
@@ -2662,6 +2722,56 @@ paths:
summary: Dashboard stats
tags:
- CreatorCenter
/t/{tenantCode}/v1/creator/members/{id}/review:
post:
consumes:
- application/json
description: Approve or reject a tenant join request
parameters:
- description: Join request ID
format: int64
in: path
name: id
required: true
type: integer
- description: Review form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.TenantJoinReviewForm'
produces:
- application/json
responses:
"200":
description: Reviewed
schema:
type: string
summary: Review join request
tags:
- CreatorCenter
/t/{tenantCode}/v1/creator/members/invite:
post:
consumes:
- application/json
description: Create an invite for tenant members
parameters:
- description: Invite form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.TenantInviteCreateForm'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/dto.TenantInviteItem'
summary: Create member invite
tags:
- CreatorCenter
/t/{tenantCode}/v1/creator/orders:
get:
consumes:
@@ -3488,6 +3598,83 @@ paths:
summary: Follow tenant
tags:
- TenantPublic
/t/{tenantCode}/v1/tenants/{id}/invites/accept:
post:
consumes:
- application/json
description: Accept a tenant invite by code
parameters:
- description: Tenant ID
format: int64
in: path
name: id
required: true
type: integer
- description: Invite form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.TenantInviteAcceptForm'
produces:
- application/json
responses:
"200":
description: Accepted
schema:
type: string
summary: Accept tenant invite
tags:
- TenantPublic
/t/{tenantCode}/v1/tenants/{id}/join:
delete:
consumes:
- application/json
description: Cancel join request for a tenant
parameters:
- description: Tenant ID
format: int64
in: path
name: id
required: true
type: integer
produces:
- application/json
responses:
"200":
description: Canceled
schema:
type: string
summary: Cancel join request
tags:
- TenantPublic
post:
consumes:
- application/json
description: Submit join request for a tenant
parameters:
- description: Tenant ID
format: int64
in: path
name: id
required: true
type: integer
- description: Join form
in: body
name: form
required: true
schema:
$ref: '#/definitions/dto.TenantJoinApplyForm'
produces:
- application/json
responses:
"200":
description: Applied
schema:
type: string
summary: Apply to join tenant
tags:
- TenantPublic
/t/{tenantCode}/v1/topics:
get:
consumes: