api : add api users

This commit is contained in:
lukman
2024-07-29 10:45:10 +08:00
parent ea7a2ba98c
commit 1a80ed184c
8 changed files with 173 additions and 31 deletions

View File

@@ -1,9 +1,28 @@
import { prisma } from "@/module/_global";
import { NextRequest } from "next/server";
export async function getOneUser(req: NextRequest) {
try {
} catch (error) {
}
}
try {
const searchParams = req.nextUrl.searchParams;
const idUser = searchParams.get("userID");
const users = await prisma.user.findUnique({
where: {
id: String(idUser),
},
select: {
id: true,
nik: true,
name: true,
phone: true,
email: true,
gender: true,
},
});
return Response.json(users);
} catch (error) {
console.error(error);
return Response.json({ message: "Internal Server Error", success: false }, { status: 500 });
}
}