28 lines
503 B
TypeScript
28 lines
503 B
TypeScript
import { prisma } from "@/lib/api/db";
|
|
export default async function (userId: number) {
|
|
const links = await prisma.link.findMany({
|
|
where: {
|
|
collection: {
|
|
OR: [
|
|
{
|
|
ownerId: userId,
|
|
},
|
|
{
|
|
members: {
|
|
some: {
|
|
userId,
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
},
|
|
include: {
|
|
tags: true,
|
|
collection: true,
|
|
},
|
|
});
|
|
|
|
return { response: links, status: 200 };
|
|
}
|