refs #5638 fix: solucionado problema con el limit
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
8578e3ca49
commit
404acdab6f
|
@ -24,20 +24,17 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
let statesList = await models.State.find(filter, myOptions);
|
||||
const isProduction = await models.VnUser.hasRole(userId, 'production', myOptions);
|
||||
const isSalesPerson = await models.VnUser.hasRole(userId, 'salesPerson', myOptions);
|
||||
const isAdministrative = await models.VnUser.hasRole(userId, 'administrative', myOptions);
|
||||
|
||||
if (isProduction || isAdministrative)
|
||||
return statesList;
|
||||
filter.where = {alertLevel: 0};
|
||||
|
||||
if (isSalesPerson) {
|
||||
return statesList = statesList.filter(stateList =>
|
||||
stateList.alertLevel === 0 || stateList.code === 'PICKER_DESIGNED'
|
||||
);
|
||||
}
|
||||
if (isSalesPerson)
|
||||
filter.where = {or: [{alertLevel: 0}, {code: 'PICKER_DESIGNED'}]};
|
||||
|
||||
return statesList.filter(stateList => stateList.alertLevel === 0);
|
||||
if (isProduction || isAdministrative) delete filter.where;
|
||||
|
||||
return models.State.find(filter, myOptions);
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue