This commit is contained in:
2026-01-23 20:35:40 +03:00
parent cf3b0e48ec
commit 66c151653e
137 changed files with 41495 additions and 0 deletions

54
prisma/settingsSeed.ts Normal file
View File

@@ -0,0 +1,54 @@
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function seedSettings() {
console.log('🌱 Seeding settings...');
const defaultSettings = [
{
key: 'dateFormat',
value: 'ar-SA',
description: 'Date format locale (ar-SA or en-US)'
},
{
key: 'currency',
value: 'JOD',
description: 'Currency code (JOD, USD, EUR, etc.)'
},
{
key: 'numberFormat',
value: 'ar-SA',
description: 'Number format locale (ar-SA or en-US)'
},
{
key: 'currencySymbol',
value: 'د.أ',
description: 'Currency symbol display'
},
{
key: 'dateDisplayFormat',
value: 'dd/MM/yyyy',
description: 'Date display format pattern'
}
];
for (const setting of defaultSettings) {
await prisma.settings.upsert({
where: { key: setting.key },
update: {},
create: setting
});
}
console.log('✅ Settings seeded successfully');
}
seedSettings()
.catch((e) => {
console.error('❌ Error seeding settings:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});