-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug-booking.js
More file actions
68 lines (60 loc) · 1.88 KB
/
debug-booking.js
File metadata and controls
68 lines (60 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
const { PrismaClient } = require('@prisma/client');
const prisma = new PrismaClient();
async function debug() {
console.log('🔍 Debugging Booking System...\n');
// 1. Check Partner User
const partner = await prisma.user.findUnique({
where: { email: 'partner@jejakin.com' },
select: { id: true, name: true, email: true, role: true },
});
console.log('1. Partner User:');
console.log(partner);
console.log('');
// 2. Check Destinations owned by Partner
const destinations = await prisma.destination.findMany({
where: { userId: partner.id },
select: { id: true, name: true, userId: true, status: true },
});
console.log('2. Destinations owned by Partner:');
console.log(destinations);
console.log('');
// 3. Check Bookings for Partner's Destinations
const bookings = await prisma.booking.findMany({
where: {
destination: {
userId: partner.id,
},
},
include: {
user: {
select: { name: true, email: true },
},
destination: {
select: { name: true, userId: true },
},
},
});
console.log('3. Bookings for Partner Destinations:');
console.log(JSON.stringify(bookings, null, 2));
console.log('');
// 4. Check Notifications for Partner
const notifications = await prisma.notification.findMany({
where: { userId: partner.id },
orderBy: { createdAt: 'desc' },
take: 5,
});
console.log('4. Partner Notifications (last 5):');
console.log(JSON.stringify(notifications, null, 2));
console.log('');
// 5. Check All Bookings
const allBookings = await prisma.booking.findMany({
include: {
user: { select: { name: true, email: true } },
destination: { select: { name: true, userId: true } },
},
});
console.log('5. All Bookings in Database:');
console.log(JSON.stringify(allBookings, null, 2));
await prisma.$disconnect();
}
debug().catch(console.error);