mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-07-01 08:16:26 +00:00
35 lines
827 B
TypeScript
35 lines
827 B
TypeScript
import { prisma } from "@linkwarden/prisma";
|
|
|
|
export default async function exportData(userId: number) {
|
|
const user = await prisma.user.findUnique({
|
|
where: { id: userId },
|
|
include: {
|
|
collections: {
|
|
include: {
|
|
rssSubscriptions: true,
|
|
links: {
|
|
omit: {
|
|
textContent: true, // Exclude to reduce payload size
|
|
preview: true,
|
|
image: true,
|
|
readable: true,
|
|
monolith: true,
|
|
pdf: true,
|
|
},
|
|
include: {
|
|
tags: true,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
pinnedLinks: true,
|
|
},
|
|
});
|
|
|
|
if (!user) return { response: "User not found.", status: 404 };
|
|
|
|
const { password, id, ...userData } = user;
|
|
|
|
return { response: userData, status: 200 };
|
|
}
|