fix(logging): updated entire server side to the new logging system

This commit is contained in:
2025-03-07 13:40:29 -06:00
parent ce11b1f57e
commit 12e15babb4
33 changed files with 482 additions and 72 deletions

View File

@@ -1,7 +1,7 @@
import {eq, sql} from "drizzle-orm";
import {db} from "../../../../../database/dbclient.js";
import {users} from "../../../../../database/schema/users.js";
import {log} from "../../../logger/logger.js";
import {createLog} from "../../../logger/logger.js";
import {createPassword} from "../../utils/createPassword.js";
const blacklistedTokens = new Set();
@@ -17,10 +17,9 @@ function isTokenBlacklisted(token: string) {
export const updateProfile = async (user: any, data: any, token: string) => {
if (isTokenBlacklisted(token)) {
log.warn(`${user.username} is trying to use a black listed token`);
createLog("warn", user.username, "auth", `${user.username} is trying to use a black listed token`);
throw Error("This token was already used");
}
log.info(`${user.user_id}`);
//re salt and encrypt the password
try {
@@ -33,6 +32,11 @@ export const updateProfile = async (user: any, data: any, token: string) => {
blacklistToken(token);
} catch (error) {
log.error(error, "There was an error updating the users profile");
createLog(
"error",
user.username,
"auth",
`Error: ${JSON.stringify(error)}, "There was an error updating the users profile"`
);
}
};