Met a jour lastConnectionAt sur /api/me

This commit is contained in:
2026-07-23 07:37:28 +02:00
parent 18bf4e60d1
commit b78a918ade
3 changed files with 26 additions and 3 deletions
+11 -1
View File
@@ -626,7 +626,17 @@ function registerAuthApiRoutes(options) {
return res.status(200).json({ ok: true });
});
options.app.get(mePath, options.requireSession, async (req, res) => {
res.json({ user: req.authUser });
const authUser = req.authUser;
if (typeof authUser?.id === "string") {
try {
await options.prisma.user.update({
where: { id: authUser.id },
data: { lastConnectionAt: /* @__PURE__ */ new Date() }
});
} catch {
}
}
res.json({ user: authUser });
});
}
export {
+1 -1
View File
File diff suppressed because one or more lines are too long