统一 Node 22 与后端安全运行基线(07-15-production-trust-closeout-cleanup)
这个提交包含在:
@@ -21,6 +21,11 @@ const INACTIVE_EMPLOYEE_ID = "00000000-0000-4000-8000-000000000004";
|
||||
const POLICY_ID = "10000000-0000-4000-8000-000000000001";
|
||||
const GENERAL_ID = "10000000-0000-4000-8000-000000000002";
|
||||
const HIDDEN_ID = "10000000-0000-4000-8000-000000000003";
|
||||
const TEST_FUTURE_OFFSET_MS = 24 * 60 * 60 * 1000;
|
||||
|
||||
function buildFutureDate() {
|
||||
return new Date(Date.now() + TEST_FUTURE_OFFSET_MS);
|
||||
}
|
||||
|
||||
function buildEmployee(overrides = {}) {
|
||||
return {
|
||||
@@ -47,7 +52,7 @@ function buildAnnouncement(overrides = {}) {
|
||||
category: "policy",
|
||||
requires_acknowledgement: true,
|
||||
acknowledgement_statement: "我已阅读并理解该制度。",
|
||||
acknowledgement_due_at: new Date("2026-06-01T15:59:59.000Z"),
|
||||
acknowledgement_due_at: buildFutureDate(),
|
||||
created_at: now,
|
||||
created_by: ADMIN_ID,
|
||||
updated_at: now,
|
||||
@@ -76,11 +81,12 @@ function matchAnnouncementWhere(item, where = {}) {
|
||||
if (where.enabled !== undefined && item.enabled !== where.enabled) {
|
||||
return false;
|
||||
}
|
||||
const now = new Date("2026-05-28T02:00:00.000Z");
|
||||
if (where.OR && item.starts_at && item.starts_at > now) {
|
||||
const startsAtUpperBound = where.OR?.find((clause) => clause.starts_at?.lte)?.starts_at.lte ?? new Date();
|
||||
const endsAtLowerBound = where.AND?.[0]?.OR?.find((clause) => clause.ends_at?.gte)?.ends_at.gte ?? new Date();
|
||||
if (where.OR && item.starts_at && item.starts_at > startsAtUpperBound) {
|
||||
return false;
|
||||
}
|
||||
if (where.AND && item.ends_at && item.ends_at < now) {
|
||||
if (where.AND && item.ends_at && item.ends_at < endsAtLowerBound) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -107,7 +113,7 @@ function createPrismaState(options = {}) {
|
||||
buildAnnouncement({
|
||||
id: HIDDEN_ID,
|
||||
title: "未来公告",
|
||||
starts_at: new Date("2026-06-01T00:00:00.000Z"),
|
||||
starts_at: buildFutureDate(),
|
||||
}),
|
||||
];
|
||||
const acknowledgements = options.acknowledgements ?? [];
|
||||
|
||||
在新工单中引用
屏蔽一个用户