Fixed files: - competitions-view.tsx: 10 strings (placeholders, labels) - subjects-view.tsx: 11 strings (types, actions, placeholders) - professional-calendar.tsx: 5 strings (event type labels) - illness-reporting-view.tsx: 3 strings (status badges) - student-detail-view.tsx: 4 strings (health form placeholders) - data-table.tsx: 2 strings (search, empty state) - compliance-wizard.tsx: 2 strings (name, state) - settings-view.tsx: 1 string (Skipped) - competence-flower-view.tsx: 1 string (Active) - disciplinary-view.tsx: 1 string (All clear) - district-management-view.tsx: 1 string (No recent activity) - competitions-view.tsx: 1 string (Stock) - ui/pagination.tsx: 3 strings (Previous, Next, More pages) - ui/breadcrumb.tsx: 1 string (More) - ui/carousel.tsx: 2 strings (Previous/Next slide) - ui/sidebar.tsx: 1 string (Sidebar title) Total: 44 hardcoded English strings replaced with German
63 lines
2.0 KiB
TypeScript
Executable File
63 lines
2.0 KiB
TypeScript
Executable File
import { PrismaClient } from '@prisma/client'
|
|
import argon2 from 'argon2'
|
|
|
|
const prisma = new PrismaClient()
|
|
const password = 'Demo2025!'
|
|
|
|
const demoUsers = [
|
|
{ email: 'demo@competencetrack.org', firstName: 'Anna', lastName: 'Müller', role: 'SCHOOL_ADMIN' },
|
|
{ email: 'demo.vice@competencetrack.org', firstName: 'Clara', lastName: 'Schmidt', role: 'VICE_PRINCIPAL' },
|
|
{ email: 'demo.teacher@competencetrack.org', firstName: 'Max', lastName: 'Lehrer', role: 'TEACHER' },
|
|
{ email: 'demo.student@competencetrack.org', firstName: 'Lena', lastName: 'Schüler', role: 'STUDENT' },
|
|
{ email: 'demo.parent@competencetrack.org', firstName: 'Thomas', lastName: 'Elter', role: 'PARENT' },
|
|
]
|
|
|
|
async function main() {
|
|
const passwordHash = await argon2.hash(password, {
|
|
type: argon2.argon2id,
|
|
memoryCost: 19 * 1024,
|
|
timeCost: 2,
|
|
parallelism: 1,
|
|
})
|
|
|
|
// Find any existing school (from seed.ts) or create one
|
|
let school = await prisma.school.findFirst()
|
|
if (!school) {
|
|
school = await prisma.school.create({
|
|
data: {
|
|
name: 'Demo Schule',
|
|
schoolType: 'GYMNASIUM',
|
|
country: 'DE',
|
|
timezone: 'Europe/Berlin',
|
|
},
|
|
})
|
|
console.log(`Created demo school: ${school.id}`)
|
|
} else {
|
|
console.log(`Using existing school: ${school.name} (${school.id})`)
|
|
}
|
|
|
|
for (const user of demoUsers) {
|
|
await prisma.user.upsert({
|
|
where: { email: user.email },
|
|
update: { isDemo: true, passwordHash, schoolId: school.id },
|
|
create: { ...user, passwordHash, locale: 'de', isDemo: true, schoolId: school.id },
|
|
})
|
|
}
|
|
|
|
const seededCount = await prisma.user.count({
|
|
where: { email: { in: demoUsers.map(({ email }) => email) }, isDemo: true },
|
|
})
|
|
if (seededCount !== demoUsers.length) throw new Error(`Expected ${demoUsers.length} demo accounts, found ${seededCount}`)
|
|
|
|
console.log(`Ensured ${seededCount} demo accounts (schoolId: ${school.id}).`)
|
|
}
|
|
|
|
main()
|
|
.catch((error) => {
|
|
console.error(error)
|
|
process.exit(1)
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect()
|
|
})
|