venues and ui changes
This commit is contained in:
5
lib/helper/fetchVenues.ts
Normal file
5
lib/helper/fetchVenues.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export async function fetchVenuesClient() {
|
||||
const res = await fetch('/api/venues/fetch', { cache: 'no-store' }) // ensure no stale cache
|
||||
if (!res.ok) throw new Error('Failed to fetch venues')
|
||||
return res.json()
|
||||
}
|
||||
@@ -10,13 +10,37 @@ export const queries = {
|
||||
username: true
|
||||
}
|
||||
},
|
||||
location: true
|
||||
venue: true
|
||||
},
|
||||
})
|
||||
|
||||
return allEvents;
|
||||
},
|
||||
|
||||
async fetchQuickViewEvents() {
|
||||
const events = await prisma.event.findMany({
|
||||
take: 3,
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
date: true,
|
||||
creator: {
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
}
|
||||
},
|
||||
venue: {
|
||||
select: {
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
|
||||
return events
|
||||
},
|
||||
|
||||
async fetchEventGuests(eventId: string) {
|
||||
return await prisma.eventGuest.findMany({
|
||||
where: { eventId },
|
||||
@@ -78,7 +102,7 @@ export const queries = {
|
||||
{ dueDate: 'asc' },
|
||||
],
|
||||
},
|
||||
location: true
|
||||
venue: true
|
||||
}
|
||||
})
|
||||
return event
|
||||
@@ -136,7 +160,7 @@ export const queries = {
|
||||
},
|
||||
|
||||
async fetchAllLocations() {
|
||||
return await prisma.location.findMany()
|
||||
return await prisma.venue.findMany()
|
||||
},
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user