OOPS, sorry guys (#655)

This commit is contained in:
Alex van Andel 2021-09-15 16:47:49 +01:00 committed by GitHub
parent 1aabf6dfdf
commit 738ee5d992
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,7 +12,7 @@ import { ClockIcon, XIcon } from "@heroicons/react/outline";
import Loader from "@components/Loader"; import Loader from "@components/Loader";
import { Button } from "@components/ui/Button"; import { Button } from "@components/ui/Button";
import { getSession } from "@lib/auth"; import { getSession } from "@lib/auth";
import { BookingStatus } from "@prisma/client"; import { BookingStatus, User } from "@prisma/client";
export default function Bookings({ bookings }) { export default function Bookings({ bookings }) {
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -208,6 +208,16 @@ export async function getServerSideProps(context) {
if (!session) { if (!session) {
return { redirect: { permanent: false, destination: "/auth/login" } }; return { redirect: { permanent: false, destination: "/auth/login" } };
} }
const user: User = await prisma.user.findUnique({
where: {
id: session.user.id,
},
select: {
email: true,
},
});
const b = await prisma.booking.findMany({ const b = await prisma.booking.findMany({
where: { where: {
OR: [ OR: [
@ -217,7 +227,7 @@ export async function getServerSideProps(context) {
{ {
attendees: { attendees: {
some: { some: {
id: session.user.id, email: user.email,
}, },
}, },
}, },