169 lines
5.2 KiB
TypeScript
169 lines
5.2 KiB
TypeScript
import 'dotenv/config';
|
|
import pg from 'pg';
|
|
import { PrismaPg } from '@prisma/adapter-pg';
|
|
import { PrismaClient } from '../src/lib/generated/prisma/client';
|
|
|
|
const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL });
|
|
const adapter = new PrismaPg(pool);
|
|
const prisma = new PrismaClient({ adapter });
|
|
|
|
const userRoles = [
|
|
{ id: 1, name: 'Super' },
|
|
{ id: 2, name: 'Admin' },
|
|
{ id: 3, name: 'Staff' },
|
|
{ id: 4, name: 'User' }
|
|
];
|
|
|
|
const solfeggioFrequencies = [
|
|
{ id: 1, name: 'Crown', value: 936 },
|
|
{ id: 2, name: '3rd Eye', value: 852 },
|
|
{ id: 3, name: 'Throat', value: 741 },
|
|
{ id: 4, name: 'Heart', value: 639 },
|
|
{ id: 5, name: 'Solar Plexus', value: 528 },
|
|
{ id: 6, name: 'Sacral', value: 417 },
|
|
{ id: 7, name: 'Root', value: 396 },
|
|
// Canonical frequencies missing from the original 7-row set. Kept as
|
|
// separate rows (with distinct unique names) so the canonical id mapping
|
|
// in v2-serializers.ts can resolve 1-9 without renumbering v1 rows.
|
|
{ id: 8, name: 'Grounding / Relief', value: 174 },
|
|
{ id: 9, name: 'Relief', value: 285 },
|
|
{ id: 10, name: 'Clarity / Wellbeing', value: 432 },
|
|
{ id: 11, name: 'Crown 963', value: 963 }
|
|
];
|
|
|
|
// Canonical id -> 7-color palette, matching the kiosk's
|
|
// DatabaseManager::seedColorPalettes() (radiantwave-rebuild).
|
|
const colorPalettes: { solfeggioFrequencyId: number; colors: string[] }[] = [
|
|
{
|
|
solfeggioFrequencyId: 1,
|
|
colors: ['#8B6914', '#B8860B', '#DAA520', '#E8B64C', '#FFD700', '#FFE9A8', '#FFF4CC']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 2,
|
|
colors: ['#8B0000', '#B22222', '#DC143C', '#FF6347', '#FF8C69', '#FFA500', '#FFDAB9']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 3,
|
|
colors: ['#FF4500', '#FF7F50', '#FF8C00', '#FFA500', '#FFC87F', '#FFDFBA', '#FFEBCD']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 4,
|
|
colors: ['#8B2252', '#CD3278', '#DB7093', '#FF69B4', '#FFB6C1', '#FFC0CB', '#FFE4E1']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 5,
|
|
colors: ['#32CD32', '#3CB371', '#90EE90', '#98FB98', '#ADFFA9', '#C8FFD2', '#F0FFF0']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 6,
|
|
colors: ['#00FF7F', '#00CED1', '#40E0D0', '#5F9EA0', '#7FFFD4', '#AFEEEE', '#E0FFFF']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 7,
|
|
colors: ['#00BFFF', '#1E90FF', '#4169E1', '#6495ED', '#87CEEB', '#ADD8E6', '#F0F8FF']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 8,
|
|
colors: ['#4B0082', '#9370DB', '#8A2BE2', '#7B68EE', '#DA70D6', '#D8BFD8', '#E6E6FA']
|
|
},
|
|
{
|
|
solfeggioFrequencyId: 9,
|
|
colors: ['#9400D3', '#BA55D3', '#C71585', '#DDA0DD', '#EE82EE', '#FFF0F5', '#FAF0FA']
|
|
}
|
|
];
|
|
|
|
const subscriptionLevels = [
|
|
{ id: 1, name: 'Basic', description: 'General only' },
|
|
{ id: 2, name: 'Advanced', description: 'General + Specific' },
|
|
{ id: 3, name: 'Elite', description: 'General + Specific + Precise' }
|
|
];
|
|
|
|
const proclamationCategories = [
|
|
{ id: 4, name: 'Spiritual', parentId: null },
|
|
{ id: 5, name: 'General', parentId: 4 },
|
|
{ id: 9, name: 'Specific', parentId: 4 },
|
|
{ id: 40, name: 'Precise', parentId: 4 },
|
|
{ id: 2, name: 'Physical', parentId: null },
|
|
{ id: 3, name: 'General', parentId: 2 },
|
|
{ id: 10, name: 'Specific', parentId: 2 },
|
|
{ id: 32, name: 'Precise', parentId: 2 },
|
|
{ id: 16, name: 'Mental', parentId: null },
|
|
{ id: 30, name: 'General', parentId: 16 },
|
|
{ id: 31, name: 'Specific', parentId: 16 },
|
|
{ id: 38, name: 'Precise', parentId: 16 },
|
|
{ id: 17, name: 'Custom (Client Specific)', parentId: null },
|
|
{ id: 19, name: 'Financial', parentId: null },
|
|
{ id: 28, name: 'General', parentId: 19 },
|
|
{ id: 29, name: 'Specific', parentId: 19 },
|
|
{ id: 37, name: 'Precise', parentId: 19 },
|
|
{ id: 20, name: 'Emotional', parentId: null },
|
|
{ id: 24, name: 'General', parentId: 20 },
|
|
{ id: 26, name: 'Specific', parentId: 20 },
|
|
{ id: 45, name: 'Precise', parentId: 20 },
|
|
{ id: 21, name: 'Social', parentId: null },
|
|
{ id: 22, name: 'General', parentId: 21 },
|
|
{ id: 23, name: 'Specific', parentId: 21 },
|
|
{ id: 39, name: 'Precise', parentId: 21 },
|
|
{ id: 41, name: 'Biblical', parentId: null },
|
|
{ id: 42, name: 'Personal Growth & Development', parentId: null },
|
|
{ id: 43, name: 'Prayers', parentId: 41 },
|
|
{ id: 44, name: 'Scripture', parentId: 41 },
|
|
{ id: 46, name: 'Sports', parentId: null }
|
|
];
|
|
|
|
async function main() {
|
|
console.log('Seeding UserRole...');
|
|
for (const role of userRoles) {
|
|
await prisma.userRole.upsert({
|
|
where: { id: role.id },
|
|
create: role,
|
|
update: role
|
|
});
|
|
}
|
|
|
|
console.log('Seeding SolfeggioFrequency...');
|
|
for (const freq of solfeggioFrequencies) {
|
|
await prisma.solfeggioFrequency.upsert({
|
|
where: { id: freq.id },
|
|
create: freq,
|
|
update: freq
|
|
});
|
|
}
|
|
|
|
console.log('Seeding ProclamationCategory...');
|
|
for (const cat of proclamationCategories) {
|
|
await prisma.proclamationCategory.upsert({
|
|
where: { id: cat.id },
|
|
create: cat,
|
|
update: cat
|
|
});
|
|
}
|
|
|
|
console.log('Seeding SubscriptionLevel...');
|
|
for (const level of subscriptionLevels) {
|
|
await prisma.subscriptionLevel.upsert({
|
|
where: { id: level.id },
|
|
create: level,
|
|
update: level
|
|
});
|
|
}
|
|
|
|
console.log('Seeding ColorPalette...');
|
|
for (const palette of colorPalettes) {
|
|
await prisma.colorPalette.upsert({
|
|
where: { solfeggioFrequencyId: palette.solfeggioFrequencyId },
|
|
create: palette,
|
|
update: palette
|
|
});
|
|
}
|
|
|
|
console.log('Seed complete.');
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error('Seed failed:', e);
|
|
process.exit(1);
|
|
})
|
|
.finally(() => prisma.$disconnect());
|