feat(rvw): complete journal config center MVP and tenant login routing
Deliver the RVW V4.0 journal configuration center across backend, frontend, migration, and docs with zh/en editorial baseline support and tenant-level prompt/template overrides. Unify tenant login to /:tenantCode/login and auto-enable RVW module when tenant type is JOURNAL to prevent post-login access gaps. Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
-- RVW V4.0 期刊配置中心 MVP
|
||||
-- 一次性补齐 tenants(P0/P1/P2+language) 与 tenant_rvw_configs(4维Prompt+Template)
|
||||
|
||||
-- 1) 枚举:JournalLanguage
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM pg_type t
|
||||
JOIN pg_namespace n ON n.oid = t.typnamespace
|
||||
WHERE t.typname = 'JournalLanguage'
|
||||
AND n.nspname = 'platform_schema'
|
||||
) THEN
|
||||
CREATE TYPE "platform_schema"."JournalLanguage" AS ENUM ('ZH', 'EN', 'OTHER');
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- 2) 枚举:TenantType 增加 JOURNAL
|
||||
DO $$
|
||||
BEGIN
|
||||
ALTER TYPE "platform_schema"."TenantType" ADD VALUE IF NOT EXISTS 'JOURNAL';
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN NULL;
|
||||
END $$;
|
||||
|
||||
-- 3) tenants 表新增字段
|
||||
ALTER TABLE "platform_schema"."tenants"
|
||||
ADD COLUMN IF NOT EXISTS "journal_language" "platform_schema"."JournalLanguage",
|
||||
ADD COLUMN IF NOT EXISTS "journal_full_name" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "logo_url" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "brand_color" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "login_background_url" TEXT;
|
||||
|
||||
ALTER TABLE "platform_schema"."tenants"
|
||||
ALTER COLUMN "journal_language" SET DEFAULT 'ZH';
|
||||
|
||||
-- 4) tenant_rvw_configs 表升级为 Prompt/Template 统一结构
|
||||
ALTER TABLE "platform_schema"."tenant_rvw_configs"
|
||||
ADD COLUMN IF NOT EXISTS "editorial_base_standard" TEXT NOT NULL DEFAULT 'en',
|
||||
ADD COLUMN IF NOT EXISTS "editorial_expert_prompt" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "editorial_handlebars_template" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "data_forensics_expert_prompt" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "data_forensics_handlebars_template" TEXT,
|
||||
ADD COLUMN IF NOT EXISTS "clinical_handlebars_template" TEXT;
|
||||
|
||||
ALTER TABLE "platform_schema"."tenant_rvw_configs"
|
||||
DROP COLUMN IF EXISTS "editorial_rules",
|
||||
DROP COLUMN IF EXISTS "data_forensics_level",
|
||||
DROP COLUMN IF EXISTS "finer_weights";
|
||||
@@ -1915,6 +1915,11 @@ model tenants {
|
||||
code String @unique
|
||||
name String
|
||||
type TenantType
|
||||
journal_language JournalLanguage? @default(ZH)
|
||||
journal_full_name String?
|
||||
logo_url String?
|
||||
brand_color String?
|
||||
login_background_url String?
|
||||
status TenantStatus @default(ACTIVE)
|
||||
config Json? @default("{}")
|
||||
total_quota BigInt @default(0)
|
||||
@@ -1964,8 +1969,14 @@ model TenantRvwConfig {
|
||||
tenantId String @unique @map("tenant_id")
|
||||
tenant tenants @relation(fields: [tenantId], references: [id], onDelete: Cascade)
|
||||
|
||||
/// 稿约规范评估:规则数组,每条规则含 code/description/fatal
|
||||
editorialRules Json? @map("editorial_rules")
|
||||
/// 稿约规范评估:默认基线(zh/en),用于继承模式的系统默认 Prompt 路由
|
||||
editorialBaseStandard String @default("en") @map("editorial_base_standard")
|
||||
|
||||
/// 稿约规范评估:租户自定义业务 Prompt(null 表示继承系统默认)
|
||||
editorialExpertPrompt String? @map("editorial_expert_prompt") @db.Text
|
||||
|
||||
/// 稿约规范评估:租户自定义报告模板(null 表示继承系统默认)
|
||||
editorialHandlebarsTemplate String? @map("editorial_handlebars_template") @db.Text
|
||||
|
||||
/// 方法学评估:专家业务评判标准(纯文本,可自由编辑,不需懂JSON)
|
||||
methodologyExpertPrompt String? @map("methodology_expert_prompt") @db.Text
|
||||
@@ -1973,15 +1984,18 @@ model TenantRvwConfig {
|
||||
/// 方法学评估:Handlebars 报告展示模板(可覆盖系统默认模板)
|
||||
methodologyHandlebarsTemplate String? @map("methodology_handlebars_template") @db.Text
|
||||
|
||||
/// 数据验证:验证深度 L1/L2/L3
|
||||
dataForensicsLevel String @default("L2") @map("data_forensics_level")
|
||||
/// 数据验证:租户自定义业务 Prompt(null 表示继承系统默认)
|
||||
dataForensicsExpertPrompt String? @map("data_forensics_expert_prompt") @db.Text
|
||||
|
||||
/// 临床评估:FINER 五维权重 {feasibility, innovation, ethics, relevance, novelty}
|
||||
finerWeights Json? @map("finer_weights")
|
||||
/// 数据验证:租户自定义报告模板(null 表示继承系统默认)
|
||||
dataForensicsHandlebarsTemplate String? @map("data_forensics_handlebars_template") @db.Text
|
||||
|
||||
/// 临床评估:专科特色补充要求(纯文本)
|
||||
clinicalExpertPrompt String? @map("clinical_expert_prompt") @db.Text
|
||||
|
||||
/// 临床评估:租户自定义报告模板(null 表示继承系统默认)
|
||||
clinicalHandlebarsTemplate String? @map("clinical_handlebars_template") @db.Text
|
||||
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@ -2011,12 +2025,21 @@ enum TenantStatus {
|
||||
enum TenantType {
|
||||
HOSPITAL // 医院
|
||||
PHARMA // 药企
|
||||
JOURNAL // 期刊
|
||||
INTERNAL // 内部(公司自己)
|
||||
PUBLIC // 个人用户公共池
|
||||
|
||||
@@schema("platform_schema")
|
||||
}
|
||||
|
||||
enum JournalLanguage {
|
||||
ZH
|
||||
EN
|
||||
OTHER
|
||||
|
||||
@@schema("platform_schema")
|
||||
}
|
||||
|
||||
enum UserRole {
|
||||
SUPER_ADMIN
|
||||
PROMPT_ENGINEER
|
||||
|
||||
Reference in New Issue
Block a user