Seed historical completed meetings through Feb 20 for all contacts

This commit is contained in:
Ruslan Bakiev
2026-02-19 08:04:29 +07:00
parent a8b8d77c3e
commit 90953d8508

View File

@@ -19,7 +19,7 @@ function loadEnvFromDotEnv() {
}
if (!key) continue;
if (key === "DATABASE_URL") {
process.env[key] = val;
if (!process.env[key]) process.env[key] = val;
continue;
}
if (!process.env[key]) process.env[key] = val;
@@ -33,6 +33,7 @@ const prisma = new PrismaClient();
const LOGIN_PHONE = "+15550000001";
const LOGIN_PASSWORD = "ConnectFlow#2026";
const LOGIN_NAME = "Connect Owner";
const REF_DATE_ISO = "2026-02-20T12:00:00.000Z";
const SCRYPT_KEY_LENGTH = 64;
@@ -43,7 +44,7 @@ function hashPassword(password) {
}
function atOffset(days, hour, minute) {
const d = new Date();
const d = new Date(REF_DATE_ISO);
d.setDate(d.getDate() + days);
d.setHours(hour, minute, 0, 0);
return d;
@@ -221,8 +222,9 @@ async function main() {
await prisma.calendarEvent.createMany({
data: contacts.flatMap((c, idx) => {
const firstStart = atOffset((idx % 21) - 3, 10 + (idx % 6), (idx * 5) % 60);
const secondStart = atOffset((idx % 28) + 1, 14 + (idx % 4), (idx * 3) % 60);
// Historical week ending on 20 Feb 2026: all seeded meetings are completed.
const firstStart = atOffset(-6 + (idx % 5), 10 + (idx % 6), (idx * 5) % 60);
const secondStart = atOffset(-5 + (idx % 5), 14 + (idx % 4), (idx * 3) % 60);
return [
{
teamId: team.id,
@@ -231,7 +233,7 @@ async function main() {
startsAt: firstStart,
endsAt: plusMinutes(firstStart, 30),
note: "Confirm integration scope, current stack, and pilot success metrics.",
status: "planned",
status: "done",
},
{
teamId: team.id,
@@ -240,7 +242,7 @@ async function main() {
startsAt: secondStart,
endsAt: plusMinutes(secondStart, 45),
note: "Review API mapping, ETL boundaries, and AI assistant guardrails.",
status: idx % 6 === 0 ? "done" : "planned",
status: "done",
},
];
}),