fix(users): Adding warehouse as valid role in clean_data function

This commit is contained in:
Josepablo C
2025-03-01 13:55:15 -06:00
parent 423a4be51b
commit ad3e62dad3

View File

@@ -94,8 +94,15 @@ function clean_user_data( data , company ){
if( data.password ){ delete data.password; }
if( data.company ){ delete data.company; }
if( data.job_role ){
/** You can only modify the role of a user if it is in the following list */
const modifiable_roles = [
'manager',
'driver',
'staff',
'warehouse'
];
/// System can only create manager,driver or staff.
if( (data.job_role !== "manager") && (data.job_role !== "driver") && (data.job_role !== "staff") ){
if( !modifiable_roles.includes( data.job_role ) ){
data.job_role = "staff";
}
}