mirror of
https://github.com/dsoaress/link-free.git
synced 2026-11-22 19:18:33 +00:00
feat: add user management section
This commit is contained in:
64 files changed
+1713
-398
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import { prisma } from 'services/prisma'
|
||||
import { ExceptionError } from 'utils/error'
|
||||
|
||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
||||
|
||||
export async function me(req: NextApiRequest, res: NextApiResponse) {
|
||||
const { userId } = req
|
||||
const response = await prisma.user.findUnique({
|
||||
where: { id: +userId },
|
||||
select: {
|
||||
id: true,
|
||||
username: true,
|
||||
lang: true,
|
||||
role: true
|
||||
}
|
||||
})
|
||||
|
||||
if (!response) {
|
||||
throw new ExceptionError('User not found', 404)
|
||||
}
|
||||
|
||||
res.status(200).json(response)
|
||||
}
|
||||
Reference in new issue
Block a user