72 lines
2.1 KiB
TypeScript
72 lines
2.1 KiB
TypeScript
import { PrismaClient } from "./generated/prisma";
|
||
import { PrismaPg } from "@prisma/adapter-pg";
|
||
import pg from "pg";
|
||
import * as dotenv from "dotenv";
|
||
|
||
dotenv.config();
|
||
|
||
const connectionString = process.env.DATABASE_URL;
|
||
if (!connectionString) throw new Error("DATABASE_URL is not set");
|
||
|
||
const pool = new pg.Pool({ connectionString });
|
||
const adapter = new PrismaPg(pool);
|
||
const prisma = new PrismaClient({ adapter });
|
||
|
||
async function main() {
|
||
console.log("Seeding projects...");
|
||
|
||
const projects = [
|
||
{
|
||
title: "VILLA AURELIAN",
|
||
description: "Menteşe'nin kalbinde, modern mimariyle doğanın buluştuğu lüks villa projesi. Brütalist dokunuşlar ve geniş cam yüzeyler ile ferah bir yaşam alanı.",
|
||
m2: 450,
|
||
rooms: "5+1",
|
||
status: "TAMAMLANDI",
|
||
images: [
|
||
"https://images.unsplash.com/photo-1600585154340-be6161a56a0c?q=80&w=2070",
|
||
"https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?q=80&w=2075"
|
||
]
|
||
},
|
||
{
|
||
title: "ZENITH APARTMANI",
|
||
description: "Şehir merkezinde yüksek mühendislik standartlarıyla inşa edilen, deprem güvenliği öncelikli modern konut projesi.",
|
||
m2: 1200,
|
||
rooms: "3+1 / 4+1",
|
||
status: "DEVAM EDİYOR",
|
||
images: [
|
||
"https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?q=80&w=2070",
|
||
"https://images.unsplash.com/photo-1497366754035-f200968a6e72?q=80&w=1974"
|
||
]
|
||
},
|
||
{
|
||
title: "MİLAS REZİDANS",
|
||
description: "Muğla'nın tarihi dokusuna uyumlu, sürdürülebilir enerji çözümleriyle donatılmış ekolojik konut kompleksi.",
|
||
m2: 3200,
|
||
rooms: "Stüdyo / 2+1",
|
||
status: "PLANLANIYOR",
|
||
images: [
|
||
"https://images.unsplash.com/photo-1503387762-592deb58ef4e?q=80&w=2062",
|
||
"https://images.unsplash.com/photo-1503387762-592deb58ef4e?q=80&w=2062"
|
||
]
|
||
}
|
||
];
|
||
|
||
for (const project of projects) {
|
||
await prisma.project.create({
|
||
data: project
|
||
});
|
||
}
|
||
|
||
console.log("Seeding complete!");
|
||
}
|
||
|
||
main()
|
||
.catch((e) => {
|
||
console.error(e);
|
||
process.exit(1);
|
||
})
|
||
.finally(async () => {
|
||
await prisma.$disconnect();
|
||
await pool.end();
|
||
});
|