fix(logging): updated entire server side to the new logging system
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import {db} from "../../../../database/dbclient.js";
|
||||
import {roles} from "../../../../database/schema/roles.js";
|
||||
import {log} from "../../logger/logger.js";
|
||||
import {createLog} from "../../logger/logger.js";
|
||||
// "view", "technician", "supervisor","manager", "admin", "systemAdmin"
|
||||
const newRoles = [
|
||||
{name: "viewer"},
|
||||
@@ -27,12 +27,17 @@ export const areRolesIn = async () => {
|
||||
.values(newRoles)
|
||||
.onConflictDoNothing() // this will only update the ones that are new :D
|
||||
.returning({name: roles.name});
|
||||
log.info(newRole, "Roles were just added due to missing them on server startup");
|
||||
createLog(
|
||||
"info",
|
||||
"lst",
|
||||
"auth",
|
||||
`${JSON.stringify(newRole)}, "Roles were just added due to missing them on server startup"`
|
||||
);
|
||||
} catch (error) {
|
||||
log.error(error, "There was an error adding new roles to the db");
|
||||
createLog("error", "lst", "auth", "There was an error adding new roles to the db");
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
log.error(error, "There was an error getting or adding new roles");
|
||||
createLog("error", "lst", "auth", "There was an error getting or adding new roles");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user