mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-16 17:59:39 +02:00
Delete apps/memoro/apps/backend/ (NestJS) and apps/memoro/apps/audio-backend/ (NestJS) — all functionality has been ported to the new Hono/Bun servers (apps/server/ and apps/audio-server/). Also clean up root and memoro package.json scripts to remove references to the old @memoro/backend and @memoro/audio-backend packages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
105 lines
2.4 KiB
TypeScript
105 lines
2.4 KiB
TypeScript
import { getDb, closeDb } from './client.js';
|
|
import { deckTemplates } from './schema/index.js';
|
|
|
|
/**
|
|
* Seed the database with initial data
|
|
*/
|
|
async function seed() {
|
|
console.log('Seeding database...');
|
|
|
|
const db = getDb();
|
|
|
|
try {
|
|
// Seed deck templates
|
|
const templates = [
|
|
{
|
|
title: 'Language Basics',
|
|
description: 'Learn basic vocabulary and phrases for a new language',
|
|
category: 'languages',
|
|
templateData: {
|
|
cards: [
|
|
{
|
|
cardType: 'flashcard' as const,
|
|
content: { front: 'Hello', back: 'Hallo', hint: 'Greeting' },
|
|
},
|
|
{
|
|
cardType: 'flashcard' as const,
|
|
content: { front: 'Goodbye', back: 'Auf Wiedersehen' },
|
|
},
|
|
],
|
|
settings: { language: 'de' },
|
|
tags: ['language', 'basics', 'german'],
|
|
},
|
|
isActive: true,
|
|
isPublic: true,
|
|
popularity: 100,
|
|
},
|
|
{
|
|
title: 'Math Fundamentals',
|
|
description: 'Essential math concepts and formulas',
|
|
category: 'education',
|
|
templateData: {
|
|
cards: [
|
|
{
|
|
cardType: 'quiz' as const,
|
|
content: {
|
|
question: 'What is 2 + 2?',
|
|
options: ['3', '4', '5', '6'],
|
|
correctAnswer: 1,
|
|
explanation: '2 + 2 equals 4',
|
|
},
|
|
},
|
|
],
|
|
settings: { difficulty: 'beginner' },
|
|
tags: ['math', 'basics'],
|
|
},
|
|
isActive: true,
|
|
isPublic: true,
|
|
popularity: 80,
|
|
},
|
|
{
|
|
title: 'Programming Concepts',
|
|
description: 'Core programming concepts and terminology',
|
|
category: 'technology',
|
|
templateData: {
|
|
cards: [
|
|
{
|
|
cardType: 'flashcard' as const,
|
|
content: {
|
|
front: 'Variable',
|
|
back: 'A named storage location in memory that holds a value',
|
|
},
|
|
},
|
|
{
|
|
cardType: 'flashcard' as const,
|
|
content: {
|
|
front: 'Function',
|
|
back: 'A reusable block of code that performs a specific task',
|
|
},
|
|
},
|
|
],
|
|
settings: {},
|
|
tags: ['programming', 'coding', 'basics'],
|
|
},
|
|
isActive: true,
|
|
isPublic: true,
|
|
popularity: 90,
|
|
},
|
|
];
|
|
|
|
console.log('Inserting deck templates...');
|
|
await db.insert(deckTemplates).values(templates).onConflictDoNothing();
|
|
|
|
console.log('Seeding completed successfully!');
|
|
} catch (error) {
|
|
console.error('Seeding failed:', error);
|
|
throw error;
|
|
} finally {
|
|
await closeDb();
|
|
}
|
|
}
|
|
|
|
seed().catch((error) => {
|
|
console.error('Seed script failed:', error);
|
|
process.exit(1);
|
|
});
|