tenant: add invites and join requests

This commit is contained in:
2025-12-18 18:27:23 +08:00
parent 462bde351d
commit ec4506fd2d
28 changed files with 5206 additions and 201 deletions

View File

@@ -0,0 +1,59 @@
package consts
import "quyun/v2/app/requests"
// swagger:enum TenantInviteStatus
// ENUM( active, disabled, expired )
type TenantInviteStatus string
// Description 返回枚举值的中文含义,用于前端展示与审计日志输出。
func (t TenantInviteStatus) Description() string {
switch t {
case TenantInviteStatusActive:
return "可用"
case TenantInviteStatusDisabled:
return "已禁用"
case TenantInviteStatusExpired:
return "已过期"
default:
return "未知状态"
}
}
// TenantInviteStatusItems 返回前端下拉选项Key=枚举字符串Value=中文描述)。
func TenantInviteStatusItems() []requests.KV {
values := TenantInviteStatusValues()
items := make([]requests.KV, 0, len(values))
for _, v := range values {
items = append(items, requests.NewKV(string(v), v.Description()))
}
return items
}
// swagger:enum TenantJoinRequestStatus
// ENUM( pending, approved, rejected )
type TenantJoinRequestStatus string
// Description 返回枚举值的中文含义,用于前端展示与审计日志输出。
func (t TenantJoinRequestStatus) Description() string {
switch t {
case TenantJoinRequestStatusPending:
return "待审核"
case TenantJoinRequestStatusApproved:
return "已通过"
case TenantJoinRequestStatusRejected:
return "已拒绝"
default:
return "未知状态"
}
}
// TenantJoinRequestStatusItems 返回前端下拉选项Key=枚举字符串Value=中文描述)。
func TenantJoinRequestStatusItems() []requests.KV {
values := TenantJoinRequestStatusValues()
items := make([]requests.KV, 0, len(values))
for _, v := range values {
items = append(items, requests.NewKV(string(v), v.Description()))
}
return items
}