added collaboration mode for collections

This commit is contained in:
Daniel
2023-04-27 00:10:48 +03:30
parent e715756cbe
commit cc8e8dbe9a
16 changed files with 279 additions and 37 deletions
@@ -8,7 +8,13 @@ import { prisma } from "@/lib/api/db";
export default async function (userId: number) {
const collections = await prisma.collection.findMany({
where: {
ownerId: userId,
OR: [
{ ownerId: userId },
{ members: { some: { user: { id: userId } } } },
],
},
include: {
members: true,
},
});