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/gPing.js
Normal file
21
src/api/user/gPing.js
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @param {import('fastify').FastifyRequest} request
|
||||
* @param {import('fastify').FastifyReply} reply
|
||||
* @param {import('fastify').FastifyInstance} fastify
|
||||
*/
|
||||
export async function gPing(request, reply, fastify, getActivityTime) {
|
||||
try {
|
||||
const user = request.params.userId;
|
||||
|
||||
const time = getActivityTime.get(user);
|
||||
console.log(time)
|
||||
|
||||
return reply.code(200)
|
||||
.send({
|
||||
lastSeenTime: time.time
|
||||
});
|
||||
} catch (err) {
|
||||
fastify.log.error(err);
|
||||
return reply.code(500).send({ error: "Internal server error" });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user