Update eventType.ts

pull/1439/head
Omar López 2021-12-30 09:40:09 -07:00 committed by GitHub
parent f670cc23f2
commit 2ada162c90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -7,7 +7,7 @@ import prisma from "@lib/prisma";
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
const session = await getSession({ req: req });
if (!session) {
if (!session?.user?.id) {
res.status(401).json({ message: "Not authenticated" });
return;
}
@ -34,7 +34,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const user = await prisma.user.findUnique({
where: {
id: session?.user?.id,
id: session.user.id,
},
select: {
id: true,
@ -83,7 +83,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
// backwards compatibility, TMP:
const typesRaw = await prisma.eventType.findMany({
where: {
userId: session?.user?.id,
userId: session.user.id,
},
select: eventTypeSelect,
});