mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 15:26:42 +02:00
style: auto-format codebase with Prettier
Applied formatting to 1487+ files using pnpm format:write - TypeScript/JavaScript files - Svelte components - Astro pages - JSON configs - Markdown docs 13 files still need manual review (Astro JSX comments)
This commit is contained in:
parent
0241f5554c
commit
d36b321d9d
3952 changed files with 661498 additions and 739751 deletions
|
|
@ -5,101 +5,101 @@ import { deckTemplates } from './schema/index.js';
|
|||
* Seed the database with initial data
|
||||
*/
|
||||
async function seed() {
|
||||
console.log('Seeding database...');
|
||||
console.log('Seeding database...');
|
||||
|
||||
const db = getDb();
|
||||
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,
|
||||
},
|
||||
];
|
||||
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('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();
|
||||
}
|
||||
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);
|
||||
console.error('Seed script failed:', error);
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue