2023-03-05 15:03:20 -06:00
|
|
|
import { prisma } from "@/lib/api/db";
|
2023-06-09 17:31:14 -05:00
|
|
|
export default async function getLink(userId: number) {
|
2023-03-28 02:31:50 -05:00
|
|
|
const links = await prisma.link.findMany({
|
2023-03-05 15:03:20 -06:00
|
|
|
where: {
|
|
|
|
collection: {
|
|
|
|
OR: [
|
|
|
|
{
|
2023-03-28 02:31:50 -05:00
|
|
|
ownerId: userId,
|
2023-03-05 15:03:20 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
members: {
|
|
|
|
some: {
|
2023-03-28 02:31:50 -05:00
|
|
|
userId,
|
2023-03-05 15:03:20 -06:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2023-03-10 13:25:33 -06:00
|
|
|
include: {
|
|
|
|
tags: true,
|
|
|
|
collection: true,
|
|
|
|
},
|
2023-03-05 15:03:20 -06:00
|
|
|
});
|
|
|
|
|
2023-03-28 02:31:50 -05:00
|
|
|
return { response: links, status: 200 };
|
2023-03-05 15:03:20 -06:00
|
|
|
}
|