39 lines
1.8 KiB
TypeScript
39 lines
1.8 KiB
TypeScript
/**
|
||
* Portal KBDB template 種子資料(portal-auth design §2.1/§3.2,Gitea #24/#25 P2)
|
||
*
|
||
* 種子資料檔慣例(rule 07 §1 / pre-write-guard *-seeds.ts 類別):
|
||
* 「裝好後預設有哪些 template」是 API 的能力,資料宣告放 server(本檔),
|
||
* 由 /init/seed(與 /portal/admin/bootstrap 的 ensure 路徑)冪等灌入 KBDB。
|
||
* 薄殼(CLI/MCP)不自帶這份清單。
|
||
*
|
||
* 零新表鐵律:這些是 KBDB 萬用表的 template(虛擬表定義),不是 D1 真表。
|
||
* 帳號「資料」(records/entries)一律寫 `{CONSOLE_TENANT}::portal` 子 namespace
|
||
* (design D-2);template 定義本身是全域 schema(templates 表無 owner 概念)。
|
||
*/
|
||
|
||
export interface PortalTemplateSeed {
|
||
name: string;
|
||
description: string;
|
||
slots: string[];
|
||
created_by: 'system';
|
||
}
|
||
|
||
export const PORTAL_TEMPLATE_SEEDS: PortalTemplateSeed[] = [
|
||
{
|
||
// design §2.1:portal 同仁帳號。password_hash 存 KDF 輸出(pbkdf2-sha256$…,D-6),
|
||
// 永不存明碼;libraries 是 JSON array 字串(["general"] / ["*"]=全庫)。
|
||
name: 'portal_user',
|
||
description: 'RAG Portal 同仁帳號(portal-auth §2.1;資料寫 {tenant}::portal 子 namespace)',
|
||
slots: ['email', 'display_name', 'status', 'role', 'password_hash', 'libraries', 'created_at', 'updated_at'],
|
||
created_by: 'system',
|
||
},
|
||
{
|
||
// design §3.2:庫目錄(admin 頁列庫用)。庫本體=知識條目 metadata_json.$.library 標記,
|
||
// 這裡只是「有哪些庫」的登記簿。
|
||
name: 'portal_library',
|
||
description: 'RAG Portal 庫目錄登記(portal-auth §3.2;庫=metadata_json.$.library 標記)',
|
||
slots: ['name', 'display_name', 'description', 'status'],
|
||
created_by: 'system',
|
||
},
|
||
];
|