CognxSafeTrack
chore: execute Sprint 38 technical debt resolution (Type Safety, Zod validation, Vitest, Mock LLM extracted)
d9879cf Download apps/api/src/scripts/sync-content.ts from safetrack/edtech: direct link, hf CLI and curl.
- Browser
- Download file 1.12 kB
-
https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/scripts/sync-content.ts
- Command line
-
hf download hf://spaces/safetrack/edtech/apps/api/src/scripts/sync-content.ts
-
curl -L -o sync-content.ts https://huggingface.co/spaces/safetrack/edtech/resolve/main/apps/api/src/scripts/sync-content.ts
1.12 kB
| import path from 'path'; | |
| import dotenv from 'dotenv'; | |
| // Load root .env | |
| dotenv.config({ path: path.resolve(__dirname, '../../../../.env') }); | |
| import { PrismaClient } from '@repo/database'; | |
| // @ts-ignore | |
| import { seedDatabase } from '@repo/database/seed'; | |
| const prisma = new PrismaClient(); | |
| async function runSync() { | |
| try { | |
| console.log('🚀 Starting content synchronization...'); | |
| // Ensure Database URL is present | |
| if (!process.env.DATABASE_URL) { | |
| throw new Error('DATABASE_URL is not defined in .env'); | |
| } | |
| const result = await seedDatabase(prisma); | |
| if (result.seeded) { | |
| console.log(`✅ Success: ${result.message}`); | |
| } else { | |
| console.warn(`⚠️ Warning: ${result.message}`); | |
| } | |
| } catch (err: unknown) { | |
| console.error('❌ Sync failed:', (err instanceof Error ? (err instanceof Error ? err.message : String(err)) : String(err))); | |
| if ((err as Error).stack) console.debug((err as Error).stack); | |
| process.exit(1); | |
| } finally { | |
| await prisma.$disconnect(); | |
| } | |
| } | |
| runSync(); | |