16 lines
358 B
TypeScript
16 lines
358 B
TypeScript
|
import { prisma } from "@/lib/api/db";
|
||
|
|
||
|
export default async (userId: number, collectionId: number) => {
|
||
|
const check: any = await prisma.collection.findFirst({
|
||
|
where: {
|
||
|
AND: {
|
||
|
id: collectionId,
|
||
|
OR: [{ ownerId: userId }, { members: { some: { userId } } }],
|
||
|
},
|
||
|
},
|
||
|
include: { members: true },
|
||
|
});
|
||
|
|
||
|
return check;
|
||
|
};
|