el.xwx.moe/lib/api/getPermission.ts

19 lines
377 B
TypeScript
Raw Normal View History

import { prisma } from "@/lib/api/db";
export default async function getPermission(
userId: number,
collectionId: number
) {
2023-03-10 13:25:33 -06:00
const check = await prisma.collection.findFirst({
where: {
AND: {
id: collectionId,
OR: [{ ownerId: userId }, { members: { some: { userId } } }],
},
},
include: { members: true },
});
return check;
}