initial
This commit is contained in:
27
api/prisma/schema.prisma
Normal file
27
api/prisma/schema.prisma
Normal file
@@ -0,0 +1,27 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = ["native", "linux-musl-openssl-3.0.x"]
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Listing {
|
||||
id String @id @default(cuid())
|
||||
title String
|
||||
slug String @unique
|
||||
image String?
|
||||
summary String
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model Testimonial {
|
||||
id String @id @default(cuid())
|
||||
name String
|
||||
area String
|
||||
text String
|
||||
rating Int @default(5)
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
48
api/prisma/seed.ts
Normal file
48
api/prisma/seed.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
const prisma = new PrismaClient();
|
||||
|
||||
async function main() {
|
||||
await prisma.listing.upsert({
|
||||
where: { slug: 'retail-lighting-retrofit-south-side' },
|
||||
update: {},
|
||||
create: {
|
||||
title: 'Retail Lighting Retrofit — South Side',
|
||||
slug: 'retail-lighting-retrofit-south-side',
|
||||
image: '/images/project-1.jpg',
|
||||
summary: 'LED conversion for 5,000 sq ft retail space; 35% energy savings.'
|
||||
}
|
||||
});
|
||||
await prisma.listing.upsert({
|
||||
where: { slug: 'panel-upgrade-ocean-drive' },
|
||||
update: {},
|
||||
create: {
|
||||
title: 'Residential Panel Upgrade — Ocean Drive',
|
||||
slug: 'panel-upgrade-ocean-drive',
|
||||
image: '/images/project-2.jpg',
|
||||
summary: '100A → 200A service upgrade with AFCI breakers and EV-ready outlet.'
|
||||
}
|
||||
});
|
||||
await prisma.listing.upsert({
|
||||
where: { slug: 'office-buildout-downtown' },
|
||||
update: {},
|
||||
create: {
|
||||
title: 'Office Build-Out — Downtown',
|
||||
slug: 'office-buildout-downtown',
|
||||
image: '/images/project-3.jpg',
|
||||
summary: 'Complete tenant build-out: power distribution, LED lighting, data wiring.'
|
||||
}
|
||||
});
|
||||
|
||||
await prisma.testimonial.createMany({
|
||||
data: [
|
||||
{ name: 'Maria S.', area: 'Ocean Drive', text: 'Panel upgrade done fast. No more tripping breakers!', rating: 5 },
|
||||
{ name: 'David R.', area: 'Downtown', text: 'Office build-out finished on time. Great team.', rating: 5 },
|
||||
{ name: 'Jennifer L.', area: 'Flour Bluff', text: 'Emergency repair on Sunday. Reliable service.', rating: 5 }
|
||||
],
|
||||
skipDuplicates: true
|
||||
});
|
||||
|
||||
console.log('Seed complete');
|
||||
}
|
||||
|
||||
main().finally(() => prisma.$disconnect());
|
||||
Reference in New Issue
Block a user