mirror of
https://github.com/KeyZox71/knl_meowscendence.git
synced 2026-01-01 06:06:41 +01:00
「✨」 feat: added ping routes for activity time
This commit is contained in:
21
src/api/user/pPing.js
Normal file
21
src/api/user/pPing.js
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @param {import('fastify').FastifyRequest} request
|
||||
* @param {import('fastify').FastifyReply} request
|
||||
* @param {import('fastify').Fastify} fastify
|
||||
*/
|
||||
export async function pPing(request, reply, fastify, setActivityTime) {
|
||||
try {
|
||||
const user = request.user;
|
||||
const currentTime = new Date().toISOString();
|
||||
|
||||
setActivityTime.run(user, currentTime);
|
||||
|
||||
return reply.code(200)
|
||||
.send({
|
||||
msg: "last seen time updated successfully"
|
||||
});
|
||||
} catch (err) {
|
||||
fastify.log.error(err);
|
||||
return reply.code(500).send({ error: "Internal server error" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user