49 lines
1.0 KiB
TypeScript
49 lines
1.0 KiB
TypeScript
import { config } from 'dotenv'
|
||
config()
|
||
|
||
import fs from 'fs'
|
||
import path from 'path'
|
||
|
||
async function getPrisma() {
|
||
const { db } = await import('./lib/db')
|
||
return db
|
||
}
|
||
|
||
async function main() {
|
||
const prisma = await getPrisma()
|
||
|
||
console.log('Süit Daire 1 aranıyor...')
|
||
const suiteRoom = await prisma.room.findFirst({
|
||
where: { nameTr: { contains: 'Süit Daire 1' } }
|
||
})
|
||
|
||
if (!suiteRoom) {
|
||
console.error('Süit Daire 1 bulunamadı!')
|
||
return
|
||
}
|
||
|
||
console.log('Standart Oda 1 (25m²) aranıyor...')
|
||
const standardRoom = await prisma.room.findFirst({
|
||
where: { nameTr: { contains: 'Standart Oda 1' } }
|
||
})
|
||
|
||
if (!standardRoom) {
|
||
console.error('Standart Oda 1 bulunamadı!')
|
||
return
|
||
}
|
||
|
||
console.log('Resimler kopyalanıyor...')
|
||
await prisma.room.update({
|
||
where: { id: standardRoom.id },
|
||
data: {
|
||
imageUrl: suiteRoom.imageUrl,
|
||
images: suiteRoom.images
|
||
}
|
||
})
|
||
|
||
console.log('Standart Oda 1 resimleri başarıyla güncellendi!')
|
||
await prisma.$disconnect()
|
||
}
|
||
|
||
main().catch(console.error)
|