fix: count without where clause is total users regardless of selection (#10703)
This commit is contained in:
1 parent
1a818ab0c3
commit
cc75899b01
1 file changed
+1
-1
@@ -40,7 +40,7 @@ export async function getHandler(req: NextApiRequest) {
|
|||||||
// If user is not ADMIN, return only his data.
|
// If user is not ADMIN, return only his data.
|
||||||
if (!isAdmin) where.id = userId;
|
if (!isAdmin) where.id = userId;
|
||||||
const [total, data] = await prisma.$transaction([
|
const [total, data] = await prisma.$transaction([
|
||||||
prisma.user.count(),
|
prisma.user.count({ where }),
|
||||||
prisma.user.findMany({ where, take, skip }),
|
prisma.user.findMany({ where, take, skip }),
|
||||||
]);
|
]);
|
||||||
const users = schemaUsersReadPublic.parse(data);
|
const users = schemaUsersReadPublic.parse(data);
|
||||||
|
|||||||
Reference in new issue
Block a user