forked from bai/curriculum-project-hub
feat(spec): pin org-feishu app binding to 1:1
- FeishuConnection.lean: FeishuAppBinding (appId + appSecretEnvelope) - Organization.feishu: Option FeishuAppBinding (Option 自带 1:1) - 删除 FeishuConnectionId (不再需要游离类型) - FeishuProfile 删除 connection 字段 (由 org 隐含)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Spec.Prelude
|
||||
|
||||
/-!
|
||||
# FeishuConnection —— 组织飞书应用绑定
|
||||
|
||||
一个组织绑定一个飞书企业应用(1:1, `Option` 结构自带)。用户经此应用登录、调飞书 API。
|
||||
绑定是组织级的;用户通过所属组织隐含获得绑定作用域。
|
||||
-/
|
||||
|
||||
namespace Spec.System
|
||||
|
||||
variable (I : Identifiers)
|
||||
|
||||
/-- 组织的飞书应用绑定(`PINNED`, 1:1)。一个组织至多绑一个飞书企业应用。 -/
|
||||
structure FeishuAppBinding where
|
||||
/-- 飞书企业应用 app_id(`OPEN` 表示)。 -/
|
||||
appId : I.FeishuAppId
|
||||
/-- 飞书企业应用 app_secret 的信封引用(`PINNED`, ADR-0024;明文不入契约)。 -/
|
||||
appSecretEnvelope : I.FeishuAppSecretRef
|
||||
|
||||
end Spec.System
|
||||
@@ -1,5 +1,6 @@
|
||||
import Spec.Prelude
|
||||
import Spec.System.User
|
||||
import Spec.System.FeishuConnection
|
||||
|
||||
/-!
|
||||
# Hierarchy —— 主体层级
|
||||
@@ -23,10 +24,12 @@ structure Platform where
|
||||
/-- 平台自有飞书应用(`PINNED`, ADR-0023)。 -/
|
||||
application : I.PlatformFeishuApplicationId
|
||||
/-- 组织(`PINNED`, ADR-0020)。project/team 必须归属且仅归属一个 org。
|
||||
角色/tenancy/凭据见 `Spec.System.Organization`。 -/
|
||||
飞书应用绑定 1:1(`Option` 自带),见 `FeishuConnection`。角色/tenancy/凭据见 `Spec.System.Organization`。 -/
|
||||
structure Organization where
|
||||
/-- 组织标识(`OPEN` 表示)。 -/
|
||||
id : I.OrganizationId
|
||||
/-- 飞书应用绑定(`PINNED`, 可选;1:1,每 org 至多一个)。 -/
|
||||
feishu : Option (FeishuAppBinding I)
|
||||
|
||||
/-- 用户(`PINNED`, 租户层独立实体)。必属一个组织。飞书身份是绑定,见 `Spec.System.User`。 -/
|
||||
structure User where
|
||||
|
||||
@@ -17,8 +17,6 @@ structure FeishuProfile where
|
||||
openId : I.FeishuOpenId
|
||||
/-- 租户内身份(`OPEN` 表示);换应用不变,比 open_id 稳定。 -/
|
||||
userId : I.FeishuUserId
|
||||
/-- 绑定所属飞书应用连接(`PINNED`;org-scoped)。 -/
|
||||
connection : I.FeishuConnectionId
|
||||
/-- 飞书显示名(`OPEN`)。 -/
|
||||
name : Option String
|
||||
/-- 飞书头像 URL(`OPEN`)。 -/
|
||||
|
||||
Reference in New Issue
Block a user