Continued improving this

This commit is contained in:
Tiago Ribeiro
2024-09-06 17:06:49 +01:00
parent 4530e4079f
commit cfe297cc38
7 changed files with 76 additions and 19 deletions

View File

@@ -13,14 +13,16 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
return;
}
const {page, size, type} = req.query as {page?: string; size?: string; type?: Type};
const users = await getLinkedUsers(
const {size, type, latestID, firstID} = req.query as {size?: string; type?: Type; latestID?: string; firstID?: string};
const {users, total} = await getLinkedUsers(
req.session.user?.id,
req.session.user?.type,
type,
page !== undefined ? parseInt(page) : undefined,
firstID,
latestID,
size !== undefined ? parseInt(size) : undefined,
);
res.status(200).json(users);
res.status(200).json({users, total});
}