chore: update website name in wrangler config and refactor compliance seeding logic
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "node_modules/wrangler/config-schema.json",
|
"$schema": "node_modules/wrangler/config-schema.json",
|
||||||
"name": "classroomio-website",
|
"name": "cio-web",
|
||||||
"main": ".svelte-kit/cloudflare/_worker.js",
|
"main": ".svelte-kit/cloudflare/_worker.js",
|
||||||
"compatibility_date": "2026-03-13",
|
"compatibility_date": "2026-03-13",
|
||||||
"compatibility_flags": ["nodejs_compat"],
|
"compatibility_flags": ["nodejs_compat"],
|
||||||
|
|||||||
@@ -464,7 +464,7 @@ export async function seedCompliance({ enterpriseOrgId }: SeedComplianceArgs) {
|
|||||||
.from(course)
|
.from(course)
|
||||||
.where(inArray(course.id, [HIPAA_COURSE_ID, SOC2_COURSE_ID]));
|
.where(inArray(course.id, [HIPAA_COURSE_ID, SOC2_COURSE_ID]));
|
||||||
const existingCourseIds = new Set(existingCourses.map((c) => c.id));
|
const existingCourseIds = new Set(existingCourses.map((c) => c.id));
|
||||||
const coursesToInsert: TNewCourse[] = [
|
const allComplianceCourses: TNewCourse[] = [
|
||||||
{
|
{
|
||||||
id: HIPAA_COURSE_ID,
|
id: HIPAA_COURSE_ID,
|
||||||
title: 'HIPAA Awareness 2026',
|
title: 'HIPAA Awareness 2026',
|
||||||
@@ -531,7 +531,8 @@ export async function seedCompliance({ enterpriseOrgId }: SeedComplianceArgs) {
|
|||||||
status: 'ACTIVE',
|
status: 'ACTIVE',
|
||||||
type: 'COMPLIANCE'
|
type: 'COMPLIANCE'
|
||||||
}
|
}
|
||||||
].filter((c) => !existingCourseIds.has(c.id!));
|
];
|
||||||
|
const coursesToInsert = allComplianceCourses.filter((c) => !existingCourseIds.has(c.id!));
|
||||||
if (coursesToInsert.length > 0) {
|
if (coursesToInsert.length > 0) {
|
||||||
await db.insert(course).values(coursesToInsert);
|
await db.insert(course).values(coursesToInsert);
|
||||||
console.log(` ✓ Inserted ${coursesToInsert.length} compliance course(s)`);
|
console.log(` ✓ Inserted ${coursesToInsert.length} compliance course(s)`);
|
||||||
|
|||||||
Reference in New Issue
Block a user