Added me support for ID's

This commit is contained in:
Akif9748 2023-08-25 13:45:55 +03:00
parent f6cafd17b9
commit 29f8af1394

View file

@ -5,6 +5,9 @@ const { themes, emailRegEx } = require("../../../lib")
const app = Router(); const app = Router();
const { join } = require("path"); const { join } = require("path");
app.param("id", async (req, res, next, id) => { app.param("id", async (req, res, next, id) => {
if (id === "me")
id = req.user.id;
req.member = await UserModel.get(id, req.user.admin ? "+lastSeen +ips" : ""); req.member = await UserModel.get(id, req.user.admin ? "+lastSeen +ips" : "");
if (!req.member) return res.error(404, `We don't have any user with id ${id}.`); if (!req.member) return res.error(404, `We don't have any user with id ${id}.`);