feat: move findAll to return arrays
This commit is contained in:
1 parent
19934d8c3a
commit
1241ae6cfc
8 files changed
+14
-17
No files matched your search
@@ -23,10 +23,9 @@ export default async function user(req: NextApiRequest, res: NextApiResponse<Res
|
||||
const { expiresAt } = apiInDb;
|
||||
// if (!apiInDb) res.status(400).json({ error: 'Your api key is not valid' });
|
||||
if (expiresAt && dateInPast(expiresAt, today)) {
|
||||
console.log(apiInDb)
|
||||
try {
|
||||
const users = await prisma.user.findMany();
|
||||
res.status(200).json({ data: { ...users } });
|
||||
const data = await prisma.user.findMany();
|
||||
res.status(200).json({ data });
|
||||
} catch (error) {
|
||||
// FIXME: Add zod for validation/error handling
|
||||
res.status(400).json({ error: error });
|
||||
|
||||
Reference in new issue
Block a user