feat: add user management section

This commit is contained in:
Daniel Soares committed 2021-12-23 18:02:47 -03:00
1 parent f977de999d
commit 19aa8d2311
64 files changed
+1713 -398

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
import { prisma } from 'services/prisma'
import { ExceptionError } from 'utils/error'
import type { NextApiRequest, NextApiResponse } from 'next'
export async function getUsers(_req: NextApiRequest, res: NextApiResponse) {
const response = await prisma.user.findMany({
select: {
id: true,
username: true,
role: true
}
})
if (!response) {
throw new ExceptionError('No data found')
}
res.status(200).json(response)
}