remove appointment from events
This commit is contained in:
@@ -14,13 +14,6 @@ const page = async () => {
|
||||
hidden: false,
|
||||
},
|
||||
include: {
|
||||
Appointments: {
|
||||
where: {
|
||||
appointmentDate: {
|
||||
gte: new Date(),
|
||||
},
|
||||
},
|
||||
},
|
||||
Participants: {
|
||||
where: {
|
||||
userId: user.id,
|
||||
@@ -32,42 +25,6 @@ const page = async () => {
|
||||
id: "desc",
|
||||
},
|
||||
});
|
||||
const appointments = await prisma.eventAppointment.findMany({
|
||||
where: {
|
||||
appointmentDate: {
|
||||
gte: new Date(),
|
||||
},
|
||||
},
|
||||
include: {
|
||||
Participants: {
|
||||
select: {
|
||||
enscriptionDate: true,
|
||||
id: true,
|
||||
userId: true,
|
||||
},
|
||||
where: {
|
||||
appointmentCancelled: false,
|
||||
},
|
||||
orderBy: {
|
||||
enscriptionDate: "asc",
|
||||
},
|
||||
},
|
||||
_count: {
|
||||
select: {
|
||||
Participants: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
const userAppointments = await prisma.eventAppointment.findMany({
|
||||
where: {
|
||||
Participants: {
|
||||
some: {
|
||||
userId: user.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-6 gap-4">
|
||||
@@ -78,15 +35,7 @@ const page = async () => {
|
||||
</div>
|
||||
|
||||
{events.map((event) => {
|
||||
return (
|
||||
<EventCard
|
||||
appointments={appointments}
|
||||
selectedAppointments={userAppointments}
|
||||
user={user}
|
||||
event={event}
|
||||
key={event.id}
|
||||
/>
|
||||
);
|
||||
return <EventCard user={user} event={event} key={event.id} />;
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user