Add read-only Noya admin panel with assignments and UX polish.
Ship admin auth, user overview, assessments, chats, assignment filters/export, security hardening, and a separate desktop admin shell with clearer assessment answers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE `homework_reports` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`userId` BIGINT UNSIGNED NOT NULL,
|
||||
`sessionOrder` INTEGER NOT NULL,
|
||||
`reportText` TEXT NOT NULL,
|
||||
`submittedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `uq_homework_reports_user_order`(`userId`, `sessionOrder`),
|
||||
INDEX `idx_homework_reports_user`(`userId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `homework_reports`
|
||||
ADD CONSTRAINT `homework_reports_userId_fkey`
|
||||
FOREIGN KEY (`userId`) REFERENCES `users`(`id`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE `homework_reports`
|
||||
ADD CONSTRAINT `homework_reports_sessionOrder_fkey`
|
||||
FOREIGN KEY (`sessionOrder`) REFERENCES `course_sessions`(`order`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,87 @@
|
||||
-- Cumulative homework/assignments: definitions, user instances, multi-reports, daily entries.
|
||||
|
||||
CREATE TABLE `assignment_definitions` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`key` VARCHAR(64) NOT NULL,
|
||||
`sessionOrder` INTEGER NOT NULL,
|
||||
`title` VARCHAR(191) NOT NULL,
|
||||
`description` TEXT NOT NULL,
|
||||
`instructions` TEXT NOT NULL,
|
||||
`assignmentType` ENUM('ONE_TIME', 'DAILY', 'ONGOING') NOT NULL,
|
||||
`formSchema` JSON NULL,
|
||||
`expectedDurationDays` INTEGER NULL,
|
||||
`suggestedEndDay` INTEGER NULL,
|
||||
`requiresReport` BOOLEAN NOT NULL DEFAULT true,
|
||||
`blocksNextSession` BOOLEAN NOT NULL DEFAULT false,
|
||||
`isFinalAssignment` BOOLEAN NOT NULL DEFAULT false,
|
||||
`displayOrder` INTEGER NOT NULL DEFAULT 0,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
UNIQUE INDEX `assignment_definitions_key_key`(`key`),
|
||||
INDEX `idx_assignment_definitions_session_order`(`sessionOrder`),
|
||||
INDEX `idx_assignment_definitions_display_order`(`displayOrder`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE `user_assignments` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`userId` BIGINT UNSIGNED NOT NULL,
|
||||
`definitionId` BIGINT UNSIGNED NOT NULL,
|
||||
`status` ENUM('NOT_STARTED', 'ACTIVE', 'IN_PROGRESS', 'REPORTED', 'COMPLETED') NOT NULL DEFAULT 'ACTIVE',
|
||||
`activatedAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`startedAt` DATETIME(3) NULL,
|
||||
`lastActivityAt` DATETIME(3) NULL,
|
||||
`completedAt` DATETIME(3) NULL,
|
||||
`draftData` JSON NULL,
|
||||
`completionNote` TEXT NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
INDEX `idx_user_assignments_user_status`(`userId`, `status`),
|
||||
INDEX `idx_user_assignments_user_activated`(`userId`, `activatedAt`),
|
||||
UNIQUE INDEX `uq_user_assignments_user_definition`(`userId`, `definitionId`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE `assignment_reports` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`userAssignmentId` BIGINT UNSIGNED NOT NULL,
|
||||
`userId` BIGINT UNSIGNED NOT NULL,
|
||||
`reportText` TEXT NOT NULL,
|
||||
`reportStatus` ENUM('completed', 'in_progress', 'difficult', 'not_started') NOT NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
|
||||
INDEX `idx_assignment_reports_ua_created`(`userAssignmentId`, `createdAt`),
|
||||
INDEX `idx_assignment_reports_user_created`(`userId`, `createdAt`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
CREATE TABLE `assignment_daily_entries` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`userAssignmentId` BIGINT UNSIGNED NOT NULL,
|
||||
`userId` BIGINT UNSIGNED NOT NULL,
|
||||
`entryDate` DATE NOT NULL,
|
||||
`responseData` JSON NOT NULL,
|
||||
`note` TEXT NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
`updatedAt` DATETIME(3) NOT NULL,
|
||||
|
||||
INDEX `idx_assignment_daily_entries_user_date`(`userId`, `entryDate`),
|
||||
UNIQUE INDEX `uq_assignment_daily_entries_ua_date`(`userAssignmentId`, `entryDate`),
|
||||
PRIMARY KEY (`id`)
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
|
||||
ALTER TABLE `assignment_definitions` ADD CONSTRAINT `assignment_definitions_sessionOrder_fkey` FOREIGN KEY (`sessionOrder`) REFERENCES `course_sessions`(`order`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `user_assignments` ADD CONSTRAINT `user_assignments_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `user_assignments` ADD CONSTRAINT `user_assignments_definitionId_fkey` FOREIGN KEY (`definitionId`) REFERENCES `assignment_definitions`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `assignment_reports` ADD CONSTRAINT `assignment_reports_userAssignmentId_fkey` FOREIGN KEY (`userAssignmentId`) REFERENCES `user_assignments`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `assignment_reports` ADD CONSTRAINT `assignment_reports_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `assignment_daily_entries` ADD CONSTRAINT `assignment_daily_entries_userAssignmentId_fkey` FOREIGN KEY (`userAssignmentId`) REFERENCES `user_assignments`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `assignment_daily_entries` ADD CONSTRAINT `assignment_daily_entries_userId_fkey` FOREIGN KEY (`userId`) REFERENCES `users`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,8 @@
|
||||
-- Additive: completion threshold + per-day status for multi-day assignments.
|
||||
-- Non-destructive: existing rows keep requiresReport / draftData / entries unchanged.
|
||||
|
||||
ALTER TABLE `assignment_definitions`
|
||||
ADD COLUMN `minValidDays` INTEGER NULL;
|
||||
|
||||
ALTER TABLE `assignment_daily_entries`
|
||||
ADD COLUMN `dayStatus` ENUM('done', 'skipped', 'difficult') NOT NULL DEFAULT 'done';
|
||||
@@ -0,0 +1,32 @@
|
||||
-- Additive: User.role for admin access control + AuditLog for sensitive admin actions.
|
||||
-- Non-destructive: existing users default to role `user`; no rows deleted.
|
||||
|
||||
ALTER TABLE `users`
|
||||
ADD COLUMN `role` ENUM('user', 'admin') NOT NULL DEFAULT 'user';
|
||||
|
||||
CREATE INDEX `idx_users_role` ON `users`(`role`);
|
||||
|
||||
CREATE TABLE `audit_logs` (
|
||||
`id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`actorUserId` BIGINT UNSIGNED NULL,
|
||||
`action` VARCHAR(64) NOT NULL,
|
||||
`targetUserId` BIGINT UNSIGNED NULL,
|
||||
`targetType` VARCHAR(64) NULL,
|
||||
`targetId` VARCHAR(191) NULL,
|
||||
`metadata` JSON NULL,
|
||||
`ipAddress` VARCHAR(64) NULL,
|
||||
`userAgent` VARCHAR(512) NULL,
|
||||
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
|
||||
|
||||
PRIMARY KEY (`id`),
|
||||
INDEX `idx_audit_logs_actor_created`(`actorUserId`, `createdAt`),
|
||||
INDEX `idx_audit_logs_action_created`(`action`, `createdAt`),
|
||||
INDEX `idx_audit_logs_target_created`(`targetUserId`, `createdAt`),
|
||||
|
||||
CONSTRAINT `audit_logs_actorUserId_fkey`
|
||||
FOREIGN KEY (`actorUserId`) REFERENCES `users`(`id`)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `audit_logs_targetUserId_fkey`
|
||||
FOREIGN KEY (`targetUserId`) REFERENCES `users`(`id`)
|
||||
ON DELETE SET NULL ON UPDATE CASCADE
|
||||
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||
@@ -15,6 +15,12 @@ enum AuthProvider {
|
||||
guest
|
||||
}
|
||||
|
||||
/// Application access role. Runtime admin checks use DB role, not ENV alone.
|
||||
enum UserRole {
|
||||
user
|
||||
admin
|
||||
}
|
||||
|
||||
enum AttemptPhase {
|
||||
pre
|
||||
post
|
||||
@@ -46,10 +52,39 @@ enum AiRunStatus {
|
||||
failed
|
||||
}
|
||||
|
||||
enum AssignmentType {
|
||||
ONE_TIME
|
||||
DAILY
|
||||
ONGOING
|
||||
}
|
||||
|
||||
enum UserAssignmentStatus {
|
||||
NOT_STARTED
|
||||
ACTIVE
|
||||
IN_PROGRESS
|
||||
REPORTED
|
||||
COMPLETED
|
||||
}
|
||||
|
||||
enum AssignmentReportStatus {
|
||||
completed
|
||||
in_progress
|
||||
difficult
|
||||
not_started
|
||||
}
|
||||
|
||||
/// Per-day outcome for DAILY / ONGOING assignments (stored on the entry row).
|
||||
enum AssignmentDayStatus {
|
||||
done
|
||||
skipped
|
||||
difficult
|
||||
}
|
||||
|
||||
model User {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
externalId String @unique @default(uuid()) @db.Char(36)
|
||||
isGuest Boolean @default(false)
|
||||
role UserRole @default(user)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@ -59,14 +94,43 @@ model User {
|
||||
journey LearningJourney?
|
||||
assessmentAttempts AssessmentAttempt[]
|
||||
sessionProgress SessionProgress[]
|
||||
homeworkReports HomeworkReport[]
|
||||
userAssignments UserAssignment[]
|
||||
assignmentReports AssignmentReport[]
|
||||
assignmentEntries AssignmentDailyEntry[]
|
||||
chatSessions ChatSession[]
|
||||
aiRuns AiAnalysisRun[]
|
||||
auditLogsAsActor AuditLog[] @relation("AuditActor")
|
||||
auditLogsAsTarget AuditLog[] @relation("AuditTarget")
|
||||
|
||||
@@index([createdAt], map: "idx_users_created_at")
|
||||
@@index([isGuest], map: "idx_users_is_guest")
|
||||
@@index([role], map: "idx_users_role")
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
/// Sensitive admin/access events. Never store passwords, hashes, tokens, or full chat/assessment payloads.
|
||||
model AuditLog {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
actorUserId BigInt? @db.UnsignedBigInt
|
||||
action String @db.VarChar(64)
|
||||
targetUserId BigInt? @db.UnsignedBigInt
|
||||
targetType String? @db.VarChar(64)
|
||||
targetId String? @db.VarChar(191)
|
||||
metadata Json?
|
||||
ipAddress String? @db.VarChar(64)
|
||||
userAgent String? @db.VarChar(512)
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
actor User? @relation("AuditActor", fields: [actorUserId], references: [id], onDelete: SetNull)
|
||||
target User? @relation("AuditTarget", fields: [targetUserId], references: [id], onDelete: SetNull)
|
||||
|
||||
@@index([actorUserId, createdAt], map: "idx_audit_logs_actor_created")
|
||||
@@index([action, createdAt], map: "idx_audit_logs_action_created")
|
||||
@@index([targetUserId, createdAt], map: "idx_audit_logs_target_created")
|
||||
@@map("audit_logs")
|
||||
}
|
||||
|
||||
model UserProfile {
|
||||
userId BigInt @id @db.UnsignedBigInt
|
||||
name String @db.VarChar(100)
|
||||
@@ -143,13 +207,113 @@ model CourseSession {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
sessionProgress SessionProgress[]
|
||||
chatSessions ChatSession[]
|
||||
sessionProgress SessionProgress[]
|
||||
homeworkReports HomeworkReport[]
|
||||
assignmentDefinitions AssignmentDefinition[]
|
||||
chatSessions ChatSession[]
|
||||
|
||||
@@index([order], map: "idx_course_sessions_order")
|
||||
@@map("course_sessions")
|
||||
}
|
||||
|
||||
/// Fixed catalog of homework/assignment definitions (seeded from code).
|
||||
model AssignmentDefinition {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
key String @unique @db.VarChar(64)
|
||||
sessionOrder Int
|
||||
title String @db.VarChar(191)
|
||||
description String @db.Text
|
||||
instructions String @db.Text
|
||||
assignmentType AssignmentType
|
||||
/// Structured form fields for drafts / daily entries (JSON). Null = free text.
|
||||
formSchema Json?
|
||||
/// Target day count for progress UI (not necessarily the completion threshold).
|
||||
expectedDurationDays Int?
|
||||
suggestedEndDay Int?
|
||||
/// Min valid «done» days to auto-complete DAILY/ONGOING. Null = never auto-complete by count.
|
||||
minValidDays Int?
|
||||
/// When false, structured response is the primary record; AssignmentReport is optional/soft.
|
||||
requiresReport Boolean @default(true)
|
||||
/// Soft check-in only; must stay false unless a clinical gate is explicitly required.
|
||||
blocksNextSession Boolean @default(false)
|
||||
isFinalAssignment Boolean @default(false)
|
||||
displayOrder Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
courseSession CourseSession @relation(fields: [sessionOrder], references: [order], onDelete: Restrict, onUpdate: Cascade)
|
||||
userAssignments UserAssignment[]
|
||||
|
||||
@@index([sessionOrder], map: "idx_assignment_definitions_session_order")
|
||||
@@index([displayOrder], map: "idx_assignment_definitions_display_order")
|
||||
@@map("assignment_definitions")
|
||||
}
|
||||
|
||||
/// Per-user instance of an assignment, activated when the related session is completed.
|
||||
model UserAssignment {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
definitionId BigInt @db.UnsignedBigInt
|
||||
status UserAssignmentStatus @default(ACTIVE)
|
||||
activatedAt DateTime @default(now())
|
||||
startedAt DateTime?
|
||||
lastActivityAt DateTime?
|
||||
completedAt DateTime?
|
||||
/// Draft answers for ONE_TIME writing assignments (JSON object keyed by field).
|
||||
draftData Json?
|
||||
completionNote String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
definition AssignmentDefinition @relation(fields: [definitionId], references: [id], onDelete: Restrict)
|
||||
reports AssignmentReport[]
|
||||
dailyEntries AssignmentDailyEntry[]
|
||||
|
||||
@@unique([userId, definitionId], map: "uq_user_assignments_user_definition")
|
||||
@@index([userId, status], map: "idx_user_assignments_user_status")
|
||||
@@index([userId, activatedAt], map: "idx_user_assignments_user_activated")
|
||||
@@map("user_assignments")
|
||||
}
|
||||
|
||||
/// Check-in / progress reports — multiple allowed per user assignment.
|
||||
model AssignmentReport {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userAssignmentId BigInt @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
reportText String @db.Text
|
||||
reportStatus AssignmentReportStatus
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
userAssignment UserAssignment @relation(fields: [userAssignmentId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@index([userAssignmentId, createdAt], map: "idx_assignment_reports_ua_created")
|
||||
@@index([userId, createdAt], map: "idx_assignment_reports_user_created")
|
||||
@@map("assignment_reports")
|
||||
}
|
||||
|
||||
/// Daily/ongoing entry — one row per calendar day per user assignment.
|
||||
model AssignmentDailyEntry {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userAssignmentId BigInt @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
entryDate DateTime @db.Date
|
||||
/// done = practiced today; skipped / difficult = logged without full activity payload.
|
||||
dayStatus AssignmentDayStatus @default(done)
|
||||
responseData Json
|
||||
note String? @db.Text
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
userAssignment UserAssignment @relation(fields: [userAssignmentId], references: [id], onDelete: Cascade)
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([userAssignmentId, entryDate], map: "uq_assignment_daily_entries_ua_date")
|
||||
@@index([userId, entryDate], map: "idx_assignment_daily_entries_user_date")
|
||||
@@map("assignment_daily_entries")
|
||||
}
|
||||
|
||||
model SessionProgress {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
@@ -169,6 +333,25 @@ model SessionProgress {
|
||||
@@map("session_progress")
|
||||
}
|
||||
|
||||
/// Learner report of homework completed for a finished session (sessions 2–10).
|
||||
model HomeworkReport {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
/// Session whose homework is being reported (the completed session, not the next one).
|
||||
sessionOrder Int
|
||||
reportText String @db.Text
|
||||
submittedAt DateTime @default(now())
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
courseSession CourseSession @relation(fields: [sessionOrder], references: [order], onDelete: Restrict, onUpdate: Cascade)
|
||||
|
||||
@@unique([userId, sessionOrder], map: "uq_homework_reports_user_order")
|
||||
@@index([userId], map: "idx_homework_reports_user")
|
||||
@@map("homework_reports")
|
||||
}
|
||||
|
||||
model AssessmentAttempt {
|
||||
id BigInt @id @default(autoincrement()) @db.UnsignedBigInt
|
||||
userId BigInt @db.UnsignedBigInt
|
||||
|
||||
+16
-6
@@ -1,22 +1,32 @@
|
||||
/**
|
||||
* Prisma seed: upsert the 11 educational course sessions.
|
||||
* Prisma seed: upsert the 11 educational course sessions and assignment definitions.
|
||||
*
|
||||
* Run: npm run prisma:seed
|
||||
* (also invoked by `prisma migrate reset` when configured)
|
||||
*/
|
||||
import { seedCourseSessions } from '../src/modules/sessions/sessions.service.js';
|
||||
import { seedCourseSessions } from '../src/modules/sessions/seedCatalog.js';
|
||||
import { PROGRAM_SESSION_COUNT } from '../src/modules/sessions/catalog.js';
|
||||
import { seedAssignmentDefinitions } from '../src/modules/assignments/assignments.service.js';
|
||||
import { ASSIGNMENT_DEFINITIONS } from '../src/modules/assignments/definitions.js';
|
||||
import { disconnectPrisma, prisma } from '../src/lib/prisma.js';
|
||||
|
||||
async function main() {
|
||||
await seedCourseSessions();
|
||||
const count = await prisma.courseSession.count();
|
||||
if (count < PROGRAM_SESSION_COUNT) {
|
||||
const sessionCount = await prisma.courseSession.count();
|
||||
if (sessionCount < PROGRAM_SESSION_COUNT) {
|
||||
throw new Error(
|
||||
`Expected at least ${PROGRAM_SESSION_COUNT} course sessions after seed, found ${count}`,
|
||||
`Expected at least ${PROGRAM_SESSION_COUNT} course sessions after seed, found ${sessionCount}`,
|
||||
);
|
||||
}
|
||||
console.log(`Seeded ${count} course sessions`);
|
||||
|
||||
const assignmentCount = await seedAssignmentDefinitions();
|
||||
if (assignmentCount < ASSIGNMENT_DEFINITIONS.length) {
|
||||
throw new Error(
|
||||
`Expected at least ${ASSIGNMENT_DEFINITIONS.length} assignment definitions, found ${assignmentCount}`,
|
||||
);
|
||||
}
|
||||
|
||||
console.log(`Seeded ${sessionCount} course sessions and ${assignmentCount} assignment definitions`);
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user