chore: 完成 R17 小团队上线收口与默认配置
这个提交包含在:
@@ -108,3 +108,12 @@ ANNOUNCEMENTS_ENABLED=false
|
||||
WORKFLOW_DEFINITION_ADMIN_ENABLED=false
|
||||
CUTOVER_CONSOLE_ENABLED=false
|
||||
OIDC_PROVIDER_LABEL=企业统一登录
|
||||
|
||||
# ===== Prisma Migration Diff(本地生成 migration 用,可选) =====
|
||||
# SHADOW_DATABASE_URL="postgresql://hyboa_user:[email protected]:5432/hyb_oa_shadow"
|
||||
|
||||
# ===== R13-R17 小团队内部管理 =====
|
||||
PRESENCE_BOARD_ENABLED=false
|
||||
WEEKLY_REPORT_ENABLED=false
|
||||
EMPLOYEE_LIFECYCLE_ENABLED=false
|
||||
TODO_BOARD_ENABLED=false
|
||||
|
||||
+1
-1
@@ -8,6 +8,6 @@ export default defineConfig({
|
||||
},
|
||||
datasource: {
|
||||
url: process.env["DATABASE_URL"],
|
||||
shadowDatabaseUrl: process.env["SHADOW_DATABASE_URL"],
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -282,6 +282,34 @@ const DEFAULT_FEATURE_FLAGS = [
|
||||
department_ids: [],
|
||||
note: "bootstrap default: force_off",
|
||||
},
|
||||
{
|
||||
flag_key: "presence_board_v1",
|
||||
override_mode: "force_off",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "bootstrap default: force_off",
|
||||
},
|
||||
{
|
||||
flag_key: "weekly_report_v1",
|
||||
override_mode: "force_off",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "bootstrap default: force_off",
|
||||
},
|
||||
{
|
||||
flag_key: "employee_lifecycle_v1",
|
||||
override_mode: "force_off",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "bootstrap default: force_off",
|
||||
},
|
||||
{
|
||||
flag_key: "todo_board_v1",
|
||||
override_mode: "force_off",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "bootstrap default: force_off",
|
||||
},
|
||||
];
|
||||
|
||||
const DEFAULT_BUDGET_CONTROL_RULES = [
|
||||
|
||||
@@ -53,6 +53,108 @@ function generateOneTimePassword() {
|
||||
return `TrialrunA1${suffix}`;
|
||||
}
|
||||
|
||||
async function ensureFeatureFlag(prisma, payload) {
|
||||
const now = new Date();
|
||||
const existing = await prisma.featureFlag.findUnique({
|
||||
where: { flag_key: payload.flag_key },
|
||||
select: { id: true, version: true },
|
||||
});
|
||||
|
||||
if (existing) {
|
||||
return prisma.featureFlag.update({
|
||||
where: { id: existing.id },
|
||||
data: {
|
||||
override_mode: payload.override_mode,
|
||||
rollout_type: payload.rollout_type,
|
||||
department_ids: payload.department_ids,
|
||||
note: payload.note,
|
||||
version: existing.version + 1,
|
||||
updated_at: now,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return prisma.featureFlag.create({
|
||||
data: {
|
||||
...payload,
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function ensureWorkspaceSetting(prisma) {
|
||||
const current = await prisma.workspaceSetting.findFirst({ select: { id: true } });
|
||||
if (current) {
|
||||
return prisma.workspaceSetting.update({
|
||||
where: { id: current.id },
|
||||
data: {
|
||||
profile: "small_team_internal",
|
||||
org_mode: "single_company",
|
||||
primary_entry_mode: "password",
|
||||
notification_strategy: "in_app",
|
||||
device_priority: "desktop",
|
||||
module_visibility_json: {
|
||||
portal: "main",
|
||||
team: "main",
|
||||
leaveRequests: "main",
|
||||
reimbursements: "main",
|
||||
assets: "main",
|
||||
weeklyReports: "main",
|
||||
todos: "main",
|
||||
announcements: "main",
|
||||
workspace: "admin",
|
||||
people: "admin",
|
||||
workflowDefinitions: "admin",
|
||||
systemSettings: "admin",
|
||||
featureFlags: "admin",
|
||||
auditLogs: "admin",
|
||||
purchaseRequests: "admin",
|
||||
travelRequests: "admin",
|
||||
budgets: "admin",
|
||||
paymentBatches: "admin",
|
||||
apOperations: "admin",
|
||||
cutover: "admin",
|
||||
erpIntegrations: "admin",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return prisma.workspaceSetting.create({
|
||||
data: {
|
||||
profile: "small_team_internal",
|
||||
org_mode: "single_company",
|
||||
primary_entry_mode: "password",
|
||||
notification_strategy: "in_app",
|
||||
device_priority: "desktop",
|
||||
module_visibility_json: {
|
||||
portal: "main",
|
||||
team: "main",
|
||||
leaveRequests: "main",
|
||||
reimbursements: "main",
|
||||
assets: "main",
|
||||
weeklyReports: "main",
|
||||
todos: "main",
|
||||
announcements: "main",
|
||||
workspace: "admin",
|
||||
people: "admin",
|
||||
workflowDefinitions: "admin",
|
||||
systemSettings: "admin",
|
||||
featureFlags: "admin",
|
||||
auditLogs: "admin",
|
||||
purchaseRequests: "admin",
|
||||
travelRequests: "admin",
|
||||
budgets: "admin",
|
||||
paymentBatches: "admin",
|
||||
apOperations: "admin",
|
||||
cutover: "admin",
|
||||
erpIntegrations: "admin",
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function ensureAdminEmployee(prisma, params) {
|
||||
const now = new Date();
|
||||
|
||||
@@ -151,6 +253,26 @@ async function main() {
|
||||
hireDate: new Date(process.env.TRIALRUN_ADMIN_HIRE_DATE ?? "2020-01-01"),
|
||||
});
|
||||
|
||||
await ensureWorkspaceSetting(prisma);
|
||||
|
||||
for (const flagKey of [
|
||||
"portal_home_v1",
|
||||
"announcements_v1",
|
||||
"global_search_v1",
|
||||
"presence_board_v1",
|
||||
"weekly_report_v1",
|
||||
"employee_lifecycle_v1",
|
||||
"todo_board_v1",
|
||||
]) {
|
||||
await ensureFeatureFlag(prisma, {
|
||||
flag_key: flagKey,
|
||||
override_mode: "force_on",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "trialrun default: force_on",
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("Seeded trialrun admin:");
|
||||
// eslint-disable-next-line no-console
|
||||
|
||||
在新工单中引用
屏蔽一个用户