chore: add pnpm workspace configuration for apps and packages
This commit is contained in:
14
apps/backend/prisma/schema.prisma
Normal file
14
apps/backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,14 @@
|
||||
// This is your Prisma schema file,
|
||||
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
||||
|
||||
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
||||
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
previewFeatures = ["strictUndefinedChecks"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
55
apps/backend/prisma/seed.ts
Normal file
55
apps/backend/prisma/seed.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
console.log('🌱 Seeding database...');
|
||||
|
||||
// Create default admin user
|
||||
const admin = await prisma.user.upsert({
|
||||
where: { email: 'admin@dreamchat.local' },
|
||||
update: {},
|
||||
create: {
|
||||
email: 'admin@dreamchat.local',
|
||||
username: 'admin',
|
||||
role: 'ADMIN',
|
||||
passwordHash: '$2b$10$YourHashedPasswordHere', // Replace with actual hash
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`✅ Created admin user: ${admin.email}`);
|
||||
|
||||
// Create a sample character
|
||||
const character = await prisma.character.upsert({
|
||||
where: {
|
||||
id: '00000000-0000-0000-0000-000000000001'
|
||||
},
|
||||
update: {},
|
||||
create: {
|
||||
id: '00000000-0000-0000-0000-000000000001',
|
||||
name: 'Alice',
|
||||
personalityPrompt: 'You are Alice, a curious and adventurous explorer who loves discovering new things. You are friendly, witty, and always eager to help.',
|
||||
backstory: 'Alice grew up in a small village at the edge of a vast forest. From a young age, she was fascinated by the unknown and would often venture into the woods to explore.',
|
||||
attributes: {
|
||||
traits: ['curious', 'brave', 'witty', 'friendly'],
|
||||
age: 25,
|
||||
species: 'human',
|
||||
skills: ['navigation', 'survival', 'cartography'],
|
||||
},
|
||||
userId: admin.id,
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`✅ Created sample character: ${character.name}`);
|
||||
|
||||
console.log('✅ Seeding complete!');
|
||||
}
|
||||
|
||||
main()
|
||||
.catch((e) => {
|
||||
console.error('❌ Seeding failed:', e);
|
||||
process.exit(1);
|
||||
})
|
||||
.finally(async () => {
|
||||
await prisma.$disconnect();
|
||||
});
|
||||
Reference in New Issue
Block a user