Many improvements.

This commit is contained in:
Daniel
2023-03-06 00:33:20 +03:30
parent f3e104aafe
commit cff10fa9b6
19 changed files with 314 additions and 79 deletions
+33
View File
@@ -0,0 +1,33 @@
import type { NextApiRequest, NextApiResponse } from "next";
import { prisma } from "@/lib/api/db";
import { Session } from "next-auth";
export default async function (
req: NextApiRequest,
res: NextApiResponse,
session: Session
) {
const tags = await prisma.link.findMany({
where: {
collection: {
OR: [
{
ownerId: session?.user.id,
},
{
members: {
some: {
userId: session?.user.id,
},
},
},
],
},
},
include: { tags: true },
});
return res.status(200).json({
response: tags || [],
});
}