This commit is contained in:
Şahan Hasret
2025-11-21 17:46:30 +03:00
parent c0b7fb463e
commit 76c31274d5
46 changed files with 3675 additions and 1043 deletions

BIN
prisma/dev.db Normal file

Binary file not shown.

138
prisma/schema.prisma Normal file
View File

@@ -0,0 +1,138 @@
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique
password String
role String @default("admin")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model SliderItem {
id Int @id @default(autoincrement())
title String
description String
buttonText String
buttonLink String
active Boolean @default(true)
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model News {
id Int @id @default(autoincrement())
title String
summary String
content String
image String
category String
author String
tags String
featured Boolean @default(false)
date String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Media {
id Int @id @default(autoincrement())
type String
title String
description String
thumbnail String
videoUrl String?
duration String?
category String?
featured Boolean @default(false)
date String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Document {
id Int @id @default(autoincrement())
title String
description String
type String
category String
size String
downloadUrl String
date String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model MetroStation {
id Int @id @default(autoincrement())
name String
status String
progress Int @default(0)
description String?
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model LiveStream {
id Int @id @default(autoincrement())
url String
title String?
active Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Message {
id Int @id @default(autoincrement())
name String
email String
phone String
subject String
type String
message String
read Boolean @default(false)
date String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model FAQ {
id Int @id @default(autoincrement())
question String
answer String
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model Camera {
id Int @id @default(autoincrement())
name String
location String
videoUrl String
status String @default("online")
viewers Int @default(0)
order Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
model SiteSettings {
id Int @id @default(autoincrement())
key String @unique
value String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

173
prisma/seed.js Normal file
View File

@@ -0,0 +1,173 @@
const { PrismaClient } = require('@prisma/client');
const { hash } = require('bcryptjs');
const prisma = new PrismaClient();
async function main() {
console.log('Seeding database...');
// Admin kullanıcı oluştur
const adminPassword = await hash(
process.env.ADMIN_DEFAULT_PASSWORD || 'admin123',
10
);
const admin = await prisma.user.upsert({
where: { username: 'admin' },
update: {},
create: {
username: 'admin',
password: adminPassword,
},
});
console.log('✓ Admin kullanıcı oluşturuldu:', admin.username);
// Slider items
const sliderItems = [
{
title: 'Ankara Metro Altyapı Projelerinde Öncü Çözümler',
description:
'Ankara Büyükşehir Belediyesi ile birlikte, modern teknoloji ve mühendislik uzmanlığımızla başkentin ulaşım ağını inşa ediyor, geleceğin metro sistemlerini bugünden hayata geçiriyoruz.',
buttonText: 'Detayları Gör',
buttonLink: '#proje-detay',
active: true,
},
{
title: 'A2 Metro Hattı İnşaatında Son Aşamaya Gelindi',
description:
'15 istasyonlu A2 Metro Hattı projemiz %75 tamamlandı. 2026 yılında hizmete açılacak modern metro hattımız, günlük 300 bin yolcuya hizmet verecek.',
buttonText: 'İlerlemeyi İzle',
buttonLink: '#metro-hatti',
active: true,
},
{
title: 'Çevre Dostu Metro Teknolojileri',
description:
'Yenilenebilir enerji kaynakları ve sürdürülebilir inşaat teknikleri ile çevre dostu metro projelerine imza atıyoruz. Karbon emisyonunu %40 azaltan yenilikçi çözümlerimiz.',
buttonText: 'Yeşil Projeler',
buttonLink: '#cevre',
active: true,
},
];
for (const item of sliderItems) {
await prisma.sliderItem.create({ data: item });
}
console.log('✓ Slider items oluşturuldu:', sliderItems.length);
// FAQs
const faqs = [
{
question: 'Metro inşaat çalışmaları ne zaman başladı?',
answer:
'A2 Metro Hattı inşaat çalışmalarımız 2021 yılında başlamış olup, proje 2026 yılında tamamlanacaktır.',
order: 1,
},
{
question: 'Hangi metro hatlarında çalışıyorsunuz?',
answer:
'Şu anda A2 Metro Hattı, Keçiören-Gölbaşı Metro Hattı ve Batıkent-Sincan Metro Hattı projelerinde aktif olarak çalışmaktayız.',
order: 2,
},
{
question: 'Çevreye olan etkiniz nedir?',
answer:
'Tüm projelerimizde çevre dostu teknolojiler kullanıyor, karbon emisyonunu en aza indirmeye özen gösteriyoruz. Ayrıca geri dönüşüm programlarımızla inşaat atıklarını azaltıyoruz.',
order: 3,
},
];
for (const faq of faqs) {
await prisma.fAQ.create({ data: faq });
}
console.log('✓ FAQs oluşturuldu:', faqs.length);
// Cameras
const cameras = [
{
name: 'A2 Metro - Ana Şantiye',
location: 'Kızılay İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online',
viewers: 1245,
order: 1,
},
{
name: 'Keçiören Hattı - Tünel Kazı',
location: 'Keçiören İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online',
viewers: 892,
order: 2,
},
{
name: 'Gölbaşı İstasyonu İnşaatı',
location: 'Gölbaşı',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'offline',
viewers: 0,
order: 3,
},
];
for (const camera of cameras) {
await prisma.camera.create({ data: camera });
}
console.log('✓ Cameras oluşturuldu:', cameras.length);
// Site Settings
await prisma.siteSettings.create({
data: {
key: 'main',
value: JSON.stringify({
contact: {
phone: '+90 (312) 555 00 00',
email: 'info@gulermakmetro.com.tr',
address:
'Ankara Büyükşehir Belediyesi İş Merkezi, Çankaya/Ankara',
kep: 'gulermak@hs01.kep.tr',
},
social: {
facebook: 'https://facebook.com/gulermakmetro',
twitter: 'https://twitter.com/gulermakmetro',
instagram: 'https://instagram.com/gulermakmetro',
youtube: 'https://youtube.com/@gulermakmetro',
linkedin: 'https://linkedin.com/company/gulermakmetro',
},
companyInfo: {
name: 'Gülermak Metro',
fullName: 'Gülermak Ankara Metro Yapım A.Ş.',
foundedYear: '2020',
},
}),
},
});
console.log('✓ Site settings oluşturuldu');
// Live Stream
await prisma.liveStream.create({
data: {
url: 'https://www.youtube.com/embed/jfKfPfyJRdk',
active: true,
title: 'A2 Metro Hattı Canlı Yayını',
},
});
console.log('✓ Live stream oluşturuldu');
console.log('✅ Seeding tamamlandı!');
}
main()
.catch((e) => {
console.error('Seeding hatası:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});

173
prisma/seed.mts Normal file
View File

@@ -0,0 +1,173 @@
import { PrismaClient } from '@prisma/client';
import { hash } from 'bcryptjs';
const prisma = new PrismaClient();
async function main() {
console.log('Seeding database...');
// Admin kullanıcı oluştur
const adminPassword = await hash(
process.env.ADMIN_DEFAULT_PASSWORD || 'admin123',
10
);
const admin = await prisma.user.upsert({
where: { username: 'admin' },
update: {},
create: {
username: 'admin',
password: adminPassword,
},
});
console.log('✓ Admin kullanıcı oluşturuldu:', admin.username);
// Slider items
const sliderItems = [
{
title: 'Ankara Metro Altyapı Projelerinde Öncü Çözümler',
description:
'Ankara Büyükşehir Belediyesi ile birlikte, modern teknoloji ve mühendislik uzmanlığımızla başkentin ulaşım ağını inşa ediyor, geleceğin metro sistemlerini bugünden hayata geçiriyoruz.',
buttonText: 'Detayları Gör',
buttonLink: '#proje-detay',
active: true,
},
{
title: 'A2 Metro Hattı İnşaatında Son Aşamaya Gelindi',
description:
'15 istasyonlu A2 Metro Hattı projemiz %75 tamamlandı. 2026 yılında hizmete açılacak modern metro hattımız, günlük 300 bin yolcuya hizmet verecek.',
buttonText: 'İlerlemeyi İzle',
buttonLink: '#metro-hatti',
active: true,
},
{
title: 'Çevre Dostu Metro Teknolojileri',
description:
'Yenilenebilir enerji kaynakları ve sürdürülebilir inşaat teknikleri ile çevre dostu metro projelerine imza atıyoruz. Karbon emisyonunu %40 azaltan yenilikçi çözümlerimiz.',
buttonText: 'Yeşil Projeler',
buttonLink: '#cevre',
active: true,
},
];
for (const item of sliderItems) {
await prisma.sliderItem.create({ data: item });
}
console.log('✓ Slider items oluşturuldu:', sliderItems.length);
// FAQs
const faqs = [
{
question: 'Metro inşaat çalışmaları ne zaman başladı?',
answer:
'A2 Metro Hattı inşaat çalışmalarımız 2021 yılında başlamış olup, proje 2026 yılında tamamlanacaktır.',
order: 1,
},
{
question: 'Hangi metro hatlarında çalışıyorsunuz?',
answer:
'Şu anda A2 Metro Hattı, Keçiören-Gölbaşı Metro Hattı ve Batıkent-Sincan Metro Hattı projelerinde aktif olarak çalışmaktayız.',
order: 2,
},
{
question: 'Çevreye olan etkiniz nedir?',
answer:
'Tüm projelerimizde çevre dostu teknolojiler kullanıyor, karbon emisyonunu en aza indirmeye özen gösteriyoruz. Ayrıca geri dönüşüm programlarımızla inşaat atıklarını azaltıyoruz.',
order: 3,
},
];
for (const faq of faqs) {
await prisma.fAQ.create({ data: faq });
}
console.log('✓ FAQs oluşturuldu:', faqs.length);
// Cameras
const cameras = [
{
name: 'A2 Metro - Ana Şantiye',
location: 'Kızılay İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online' as const,
viewers: 1245,
order: 1,
},
{
name: 'Keçiören Hattı - Tünel Kazı',
location: 'Keçiören İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online' as const,
viewers: 892,
order: 2,
},
{
name: 'Gölbaşı İstasyonu İnşaatı',
location: 'Gölbaşı',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'offline' as const,
viewers: 0,
order: 3,
},
];
for (const camera of cameras) {
await prisma.camera.create({ data: camera });
}
console.log('✓ Cameras oluşturuldu:', cameras.length);
// Site Settings
await prisma.siteSettings.create({
data: {
key: 'main',
value: JSON.stringify({
contact: {
phone: '+90 (312) 555 00 00',
email: 'info@gulermakmetro.com.tr',
address:
'Ankara Büyükşehir Belediyesi İş Merkezi, Çankaya/Ankara',
kep: 'gulermak@hs01.kep.tr',
},
social: {
facebook: 'https://facebook.com/gulermakmetro',
twitter: 'https://twitter.com/gulermakmetro',
instagram: 'https://instagram.com/gulermakmetro',
youtube: 'https://youtube.com/@gulermakmetro',
linkedin: 'https://linkedin.com/company/gulermakmetro',
},
companyInfo: {
name: 'Gülermak Metro',
fullName: 'Gülermak Ankara Metro Yapım A.Ş.',
foundedYear: '2020',
},
}),
},
});
console.log('✓ Site settings oluşturuldu');
// Live Stream
await prisma.liveStream.create({
data: {
url: 'https://www.youtube.com/embed/jfKfPfyJRdk',
active: true,
title: 'A2 Metro Hattı Canlı Yayını',
},
});
console.log('✓ Live stream oluşturuldu');
console.log('✅ Seeding tamamlandı!');
}
main()
.catch((e) => {
console.error('Seeding hatası:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});

173
prisma/seed.ts Normal file
View File

@@ -0,0 +1,173 @@
import { hash } from 'bcryptjs';
import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('Seeding database...');
// Admin kullanıcı oluştur
const adminPassword = await hash(
process.env.ADMIN_DEFAULT_PASSWORD || 'admin123',
10
);
const admin = await prisma.user.upsert({
where: { username: 'admin' },
update: {},
create: {
username: 'admin',
password: adminPassword,
},
});
console.log('✓ Admin kullanıcı oluşturuldu:', admin.username);
// Slider items
const sliderItems = [
{
title: 'Ankara Metro Altyapı Projelerinde Öncü Çözümler',
description:
'Ankara Büyükşehir Belediyesi ile birlikte, modern teknoloji ve mühendislik uzmanlığımızla başkentin ulaşım ağını inşa ediyor, geleceğin metro sistemlerini bugünden hayata geçiriyoruz.',
buttonText: 'Detayları Gör',
buttonLink: '#proje-detay',
active: true,
},
{
title: 'A2 Metro Hattı İnşaatında Son Aşamaya Gelindi',
description:
'15 istasyonlu A2 Metro Hattı projemiz %75 tamamlandı. 2026 yılında hizmete açılacak modern metro hattımız, günlük 300 bin yolcuya hizmet verecek.',
buttonText: 'İlerlemeyi İzle',
buttonLink: '#metro-hatti',
active: true,
},
{
title: 'Çevre Dostu Metro Teknolojileri',
description:
'Yenilenebilir enerji kaynakları ve sürdürülebilir inşaat teknikleri ile çevre dostu metro projelerine imza atıyoruz. Karbon emisyonunu %40 azaltan yenilikçi çözümlerimiz.',
buttonText: 'Yeşil Projeler',
buttonLink: '#cevre',
active: true,
},
];
for (const item of sliderItems) {
await prisma.sliderItem.create({ data: item });
}
console.log('✓ Slider items oluşturuldu:', sliderItems.length);
// FAQs
const faqs = [
{
question: 'Metro inşaat çalışmaları ne zaman başladı?',
answer:
'A2 Metro Hattı inşaat çalışmalarımız 2021 yılında başlamış olup, proje 2026 yılında tamamlanacaktır.',
order: 1,
},
{
question: 'Hangi metro hatlarında çalışıyorsunuz?',
answer:
'Şu anda A2 Metro Hattı, Keçiören-Gölbaşı Metro Hattı ve Batıkent-Sincan Metro Hattı projelerinde aktif olarak çalışmaktayız.',
order: 2,
},
{
question: 'Çevreye olan etkiniz nedir?',
answer:
'Tüm projelerimizde çevre dostu teknolojiler kullanıyor, karbon emisyonunu en aza indirmeye özen gösteriyoruz. Ayrıca geri dönüşüm programlarımızla inşaat atıklarını azaltıyoruz.',
order: 3,
},
];
for (const faq of faqs) {
await prisma.fAQ.create({ data: faq });
}
console.log('✓ FAQs oluşturuldu:', faqs.length);
// Cameras
const cameras = [
{
name: 'A2 Metro - Ana Şantiye',
location: 'Kızılay İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online',
viewers: 1245,
order: 1,
},
{
name: 'Keçiören Hattı - Tünel Kazı',
location: 'Keçiören İstasyonu',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'online',
viewers: 892,
order: 2,
},
{
name: 'Gölbaşı İstasyonu İnşaatı',
location: 'Gölbaşı',
videoUrl: 'https://www.youtube.com/embed/dQw4w9WgXcQ',
status: 'offline',
viewers: 0,
order: 3,
},
];
for (const camera of cameras) {
await prisma.camera.create({ data: camera });
}
console.log('✓ Cameras oluşturuldu:', cameras.length);
// Site Settings
await prisma.siteSettings.create({
data: {
key: 'main',
value: JSON.stringify({
contact: {
phone: '+90 (312) 555 00 00',
email: 'info@gulermakmetro.com.tr',
address:
'Ankara Büyükşehir Belediyesi İş Merkezi, Çankaya/Ankara',
kep: 'gulermak@hs01.kep.tr',
},
social: {
facebook: 'https://facebook.com/gulermakmetro',
twitter: 'https://twitter.com/gulermakmetro',
instagram: 'https://instagram.com/gulermakmetro',
youtube: 'https://youtube.com/@gulermakmetro',
linkedin: 'https://linkedin.com/company/gulermakmetro',
},
companyInfo: {
name: 'Gülermak Metro',
fullName: 'Gülermak Ankara Metro Yapım A.Ş.',
foundedYear: '2020',
},
}),
},
});
console.log('✓ Site settings oluşturuldu');
// Live Stream
await prisma.liveStream.create({
data: {
url: 'https://www.youtube.com/embed/jfKfPfyJRdk',
active: true,
title: 'A2 Metro Hattı Canlı Yayını',
},
});
console.log('✓ Live stream oluşturuldu');
console.log('✅ Seeding tamamlandı!');
}
main()
.catch((e) => {
console.error('Seeding hatası:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});