backTemplate/routes/auth/checkSession.js
2025-05-11 14:48:27 +05:00

17 lines
329 B
JavaScript

const db = require('../../db');
const checkSession = async (token) => {
try {
const [sessionIsValid] = await db('users')
.select('id')
.whereNull('deletedAt')
.andWhere('sessionToken', '=', token);
return !!sessionIsValid
} catch (e) {
return 'error' + e
}
}
module.exports = checkSession;