change psql-lib from knex to postgres.js

This commit is contained in:
Flummi
2022-03-31 13:34:51 +02:00
parent f750a9a60f
commit c498a33cbe
20 changed files with 689 additions and 973 deletions

View File

@@ -1,4 +1,4 @@
import sql from "../../inc/sql.mjs";
import db from "../../inc/sql.mjs";
const auth = async (req, res, next) => {
if(!req.session)
@@ -9,9 +9,16 @@ const auth = async (req, res, next) => {
export default (router, tpl) => {
router.group(/^\/settings/, group => {
group.get(/$/, auth, async (req, res) => {
const sessions = await sql("user_sessions")
/*const sessions = await sql("user_sessions")
.where("user_id", req.session.id)
.orderBy("last_used", "desc");
.orderBy("last_used", "desc");*/
const sessions = await db`
select *
from user_sessions
where user_id = ${ +req.session.id }
order by last_used desc
`;
res.reply({
body: tpl.render('settings', {