2024-03-05 10:20:36 +00:00

13 lines
349 B
JavaScript
Executable File

import { Session } from "@shared-classes/DbModels"
export default {
method: "GET",
route: "/all",
middlewares: ["withAuthentication"],
fn: async (req, res) => {
const sessions = await Session.find({ user_id: req.user._id.toString() }, { token: 0 })
.sort({ date: -1 })
return res.json(sessions)
},
}