Allow updating production plan responsibility
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 2m13s

This commit is contained in:
Cauê Faleiros
2026-08-25 16:42:51 -03:00
parent c259ddea29
commit 3a0cc9ffe8
6 changed files with 97 additions and 41 deletions

View File

@@ -1,6 +1,8 @@
const crypto = require('crypto');
const { pool } = require('../db');
const SYSTEM_OPERATIONAL_USER_NAME = 'Super Admin';
const HASH_ALGORITHM = 'scrypt';
const KEY_LENGTH = 64;
@@ -70,10 +72,14 @@ const listActiveOperationalUsers = async () => {
ORDER BY LOWER(name), id`
);
return result.rows.map((row) => ({
id: Number(row.id),
name: row.name
}));
return [
{ id: null, name: SYSTEM_OPERATIONAL_USER_NAME, isSystem: true },
...result.rows.map((row) => ({
id: Number(row.id),
name: row.name,
isSystem: false
}))
];
};
const getActiveOperationalUserById = async (id, client = pool) => {
@@ -234,6 +240,7 @@ module.exports = {
listUsers,
normalizeEmail,
publicUserFields,
SYSTEM_OPERATIONAL_USER_NAME,
updateUser,
verifyPassword
};