create review and profile
This commit is contained in:
+33
-16
@@ -12,6 +12,7 @@ async function main() {
|
||||
console.log("🌱 Seeding database...\n");
|
||||
|
||||
// Clean existing data (order matters for FK)
|
||||
await prisma.tripReview.deleteMany();
|
||||
await prisma.tripParticipant.deleteMany();
|
||||
await prisma.tripImage.deleteMany();
|
||||
await prisma.trip.deleteMany();
|
||||
@@ -93,11 +94,18 @@ async function main() {
|
||||
console.log(" Password semua: password123\n");
|
||||
|
||||
// ==================== TRIPS + IMAGES ====================
|
||||
/**
|
||||
* Tanggal disimpan eksplisit di UTC agar filter `from`/`to` (YYYY-MM-DD UTC)
|
||||
* cocok dengan yang tampil di daftar.
|
||||
*
|
||||
* - Multi hari: isi `endDate` = hari terakhir trip (UTC).
|
||||
* - Satu hari / night hike satu malam: `endDate` null — filter memakai instan `date`
|
||||
* dalam rentang hari UTC yang sama (jam tetap masuk hari itu).
|
||||
*/
|
||||
const utc = (y: number, m0: number, d: number, h = 12, min = 0) =>
|
||||
new Date(Date.UTC(y, m0, d, h, min, 0, 0));
|
||||
|
||||
const now = new Date();
|
||||
const day = 24 * 60 * 60 * 1000;
|
||||
|
||||
// --- Trip 1: Papandayan (by Dede Inoen) ---
|
||||
// --- Trip 1: Papandayan (by Dede Inoen) — 2 hari ---
|
||||
const trip1 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Open Trip Papandayan Weekend",
|
||||
@@ -112,7 +120,8 @@ Itinerary:
|
||||
- Minggu: Sunrise → Turun → Pulang`,
|
||||
mountain: "Gunung Papandayan",
|
||||
location: "Garut, Jawa Barat",
|
||||
date: new Date(now.getTime() + 3 * day),
|
||||
date: utc(2026, 3, 23, 8, 0),
|
||||
endDate: utc(2026, 3, 24, 18, 0),
|
||||
maxParticipants: 10,
|
||||
price: 250000,
|
||||
status: "OPEN",
|
||||
@@ -127,7 +136,7 @@ Itinerary:
|
||||
},
|
||||
});
|
||||
|
||||
// --- Trip 2: Ciremai (by Panji Petualang) ---
|
||||
// --- Trip 2: Ciremai (by Panji Petualang) — 2 hari ---
|
||||
const trip2 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Pendakian Ciremai via Apuy",
|
||||
@@ -142,7 +151,8 @@ Itinerary:
|
||||
- Hari 2: Summit attack → Turun → Pulang`,
|
||||
mountain: "Gunung Ciremai",
|
||||
location: "Kuningan, Jawa Barat",
|
||||
date: new Date(now.getTime() + 5 * day),
|
||||
date: utc(2026, 3, 25, 4, 0),
|
||||
endDate: utc(2026, 3, 26, 18, 0),
|
||||
maxParticipants: 8,
|
||||
price: 350000,
|
||||
status: "OPEN",
|
||||
@@ -157,7 +167,7 @@ Itinerary:
|
||||
},
|
||||
});
|
||||
|
||||
// --- Trip 3: Gede-Pangrango (by Fiersa Besari) ---
|
||||
// --- Trip 3: Gede-Pangrango (by Fiersa Besari) — 2 hari ---
|
||||
const trip3 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Sunrise Trip Gede-Pangrango",
|
||||
@@ -170,7 +180,8 @@ Itinerary:
|
||||
Start malam, summit saat sunrise. View epic dijamin!`,
|
||||
mountain: "Gunung Gede",
|
||||
location: "Bogor/Cianjur, Jawa Barat",
|
||||
date: new Date(now.getTime() + 6 * day),
|
||||
date: utc(2026, 3, 27, 22, 0),
|
||||
endDate: utc(2026, 3, 28, 16, 0),
|
||||
maxParticipants: 12,
|
||||
price: 280000,
|
||||
status: "OPEN",
|
||||
@@ -186,7 +197,7 @@ Start malam, summit saat sunrise. View epic dijamin!`,
|
||||
},
|
||||
});
|
||||
|
||||
// --- Trip 4: Tangkuban Parahu (by Dede Inoen) ---
|
||||
// --- Trip 4: Tangkuban Parahu (by Dede Inoen) — 1 hari ---
|
||||
const trip4 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Trip Hemat Tangkuban Parahu",
|
||||
@@ -199,7 +210,8 @@ Start malam, summit saat sunrise. View epic dijamin!`,
|
||||
Explore Kawah Ratu, Kawah Domas, foto-foto, terus makan sate maranggi!`,
|
||||
mountain: "Gunung Tangkuban Parahu",
|
||||
location: "Bandung, Jawa Barat",
|
||||
date: new Date(now.getTime() + 2 * day),
|
||||
date: utc(2026, 3, 22, 0, 0),
|
||||
endDate: null,
|
||||
maxParticipants: 15,
|
||||
price: 120000,
|
||||
status: "OPEN",
|
||||
@@ -213,7 +225,7 @@ Explore Kawah Ratu, Kawah Domas, foto-foto, terus makan sate maranggi!`,
|
||||
},
|
||||
});
|
||||
|
||||
// --- Trip 5: Malabar (by Fiersa Besari) ---
|
||||
// --- Trip 5: Malabar (by Fiersa Besari) — 1 hari (night hike, `endDate` null) ---
|
||||
const trip5 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Malabar Night Hike",
|
||||
@@ -226,7 +238,8 @@ Explore Kawah Ratu, Kawah Domas, foto-foto, terus makan sate maranggi!`,
|
||||
Trip ringan, 3-4 jam naik. Cocok buat yang mau healing malam-malam.`,
|
||||
mountain: "Gunung Malabar",
|
||||
location: "Bandung, Jawa Barat",
|
||||
date: new Date(now.getTime() + 4 * day),
|
||||
date: utc(2026, 3, 20, 14, 0),
|
||||
endDate: null,
|
||||
maxParticipants: 10,
|
||||
price: 150000,
|
||||
status: "OPEN",
|
||||
@@ -241,7 +254,7 @@ Trip ringan, 3-4 jam naik. Cocok buat yang mau healing malam-malam.`,
|
||||
},
|
||||
});
|
||||
|
||||
// --- Trip 6: Guntur (by Panji Petualang) ---
|
||||
// --- Trip 6: Guntur (by Panji Petualang) — 2 hari ---
|
||||
const trip6 = await prisma.trip.create({
|
||||
data: {
|
||||
title: "Guntur Challenge Trip",
|
||||
@@ -254,7 +267,8 @@ Trip ringan, 3-4 jam naik. Cocok buat yang mau healing malam-malam.`,
|
||||
Buat yang suka challenge. Pemandangan kawah aktif dari dekat!`,
|
||||
mountain: "Gunung Guntur",
|
||||
location: "Garut, Jawa Barat",
|
||||
date: new Date(now.getTime() + 10 * day),
|
||||
date: utc(2026, 3, 30, 4, 0),
|
||||
endDate: utc(2026, 4, 1, 18, 0),
|
||||
maxParticipants: 8,
|
||||
price: 300000,
|
||||
status: "OPEN",
|
||||
@@ -269,7 +283,10 @@ Buat yang suka challenge. Pemandangan kawah aktif dari dekat!`,
|
||||
},
|
||||
});
|
||||
|
||||
console.log("✅ 6 Trips + images created\n");
|
||||
console.log("✅ 6 Trips + images created (tanggal UTC + endDate untuk trip multi hari)\n");
|
||||
console.log(
|
||||
` Guntur: ${trip6.title} ${trip6.date.toISOString().slice(0, 10)} → ${trip6.endDate?.toISOString().slice(0, 10) ?? "-"}\n`
|
||||
);
|
||||
|
||||
// ==================== PARTICIPANTS ====================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user