fix: R27-5 R27-6 收口本地回归基线与E2E适配
这个提交包含在:
@@ -257,6 +257,79 @@ async function ensureHolidayCalendar(prisma, payload) {
|
||||
return calendar;
|
||||
}
|
||||
|
||||
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 } });
|
||||
const 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",
|
||||
},
|
||||
};
|
||||
|
||||
if (current) {
|
||||
return prisma.workspaceSetting.update({
|
||||
where: { id: current.id },
|
||||
data,
|
||||
});
|
||||
}
|
||||
|
||||
return prisma.workspaceSetting.create({ data });
|
||||
}
|
||||
|
||||
async function ensureEmployee(prisma, payload) {
|
||||
const now = new Date();
|
||||
const passwordHash = await hashPassword(payload.password);
|
||||
@@ -378,6 +451,31 @@ async function main() {
|
||||
taxNo: null,
|
||||
});
|
||||
|
||||
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",
|
||||
"project_domain_v1",
|
||||
"project_linking_v1",
|
||||
"project_communication_log_v1",
|
||||
"project_closure_checklist_v1",
|
||||
"confidential_doc_refs_v1",
|
||||
]) {
|
||||
await ensureFeatureFlag(prisma, {
|
||||
flag_key: flagKey,
|
||||
override_mode: "force_on",
|
||||
rollout_type: "global",
|
||||
department_ids: [],
|
||||
note: "dev default: force_on",
|
||||
});
|
||||
}
|
||||
|
||||
const ceo = await ensureEmployee(prisma, {
|
||||
employeeNo: process.env.SEED_CEO_EMPLOYEE_NO ?? "E0001",
|
||||
name: "CEO",
|
||||
|
||||
在新工单中引用
屏蔽一个用户