renamed the "data" route to "migration"

This commit is contained in:
daniel31x13
2023-10-01 20:03:40 +03:30
parent fdcae013c6
commit 8fc8874063
6 changed files with 240 additions and 12 deletions
+24
View File
@@ -0,0 +1,24 @@
import { prisma } from "@/lib/api/db";
export default async function getData(userId: number) {
const user = await prisma.user.findUnique({
where: { id: userId },
include: {
collections: {
include: {
links: {
include: {
tags: true,
},
},
},
},
},
});
if (!user) return { response: "User not found.", status: 404 };
const { password, id, image, ...userData } = user;
return { response: userData, status: 200 };
}