Fixes #701: User's page shows Team events with broken links (#761)

This commit is contained in:
Alex van Andel 2021-09-24 11:23:08 +01:00 committed by GitHub
parent 420daec147
commit 2b2fde179a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -92,16 +92,23 @@ export const getServerSideProps = async (context: GetServerSidePropsContext) =>
const eventTypesWithHidden = await prisma.eventType.findMany({ const eventTypesWithHidden = await prisma.eventType.findMany({
where: { where: {
OR: [ AND: [
{ {
userId: user.id, teamId: null,
}, },
{ {
users: { OR: [
some: { {
id: user.id, userId: user.id,
}, },
}, {
users: {
some: {
id: user.id,
},
},
},
],
}, },
], ],
}, },