Merge branch '6005-backupLabeler' of https://gitea.verdnatura.es/verdnatura/salix into 6005-backupLabeler
gitea/salix/pipeline/head There was a failure building this commit Details
gitea/salix/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Pablo Natek 2023-12-19 14:07:48 +01:00
commit c10a79493a
4 changed files with 34 additions and 17 deletions

View File

@ -3,7 +3,7 @@ CREATE OR REPLACE DEFINER=`root`@`localhost`
VIEW `vn`.`ticketState` VIEW `vn`.`ticketState`
AS SELECT `tt`.`created` AS `updated`, AS SELECT `tt`.`created` AS `updated`,
`tt`.`stateFk` AS `stateFk`, `tt`.`stateFk` AS `stateFk`,
`tt`.`userFk` AS `userFk`, `tt`.`userFk` AS `workerFk`,
`tls`.`ticketFk` AS `ticketFk`, `tls`.`ticketFk` AS `ticketFk`,
`s`.`id` AS `state`, `s`.`id` AS `state`,
`s`.`order` AS `productionOrder`, `s`.`order` AS `productionOrder`,
@ -40,7 +40,7 @@ SELECT
`ts`.`state` AS `state`, `ts`.`state` AS `state`,
`ts`.`productionOrder` AS `productionOrder`, `ts`.`productionOrder` AS `productionOrder`,
`ts`.`alertLevel` AS `alertLevel`, `ts`.`alertLevel` AS `alertLevel`,
`ts`.`userFk` AS `userFk`, `ts`.`userFk` AS `worker`,
`ts`.`code` AS `code`, `ts`.`code` AS `code`,
`ts`.`updated` AS `updated`, `ts`.`updated` AS `updated`,
`ts`.`isPicked` AS `isPicked` `ts`.`isPicked` AS `isPicked`

View File

@ -107,17 +107,29 @@ module.exports = Self => {
return {or: [ return {or: [
{'c.phone': {like: `%${value}%`}}, {'c.phone': {like: `%${value}%`}},
{'c.mobile': {like: `%${value}%`}}, {'c.mobile': {like: `%${value}%`}},
{'a.phone': {like: `%${value}%`}},
]}; ]};
case 'zoneFk': case 'zoneFk':
param = 'a.postalCode'; return {'a.postalCode': {inq: postalCode}};
return {[param]: {inq: postalCode}}; case 'city':
return {or: [
{'c.city': {like: `%${value}%`}},
{'a.city': {like: `%${value}%`}}
]};
case 'postcode':
return {or: [
{'c.postcode': value},
{'a.postalCode': value}
]};
case 'provinceFk':
return {or: [
{'p.id': value},
{'a.provinceFk': value}
]};
case 'name': case 'name':
case 'salesPersonFk': case 'salesPersonFk':
case 'fi': case 'fi':
case 'socialName': case 'socialName':
case 'city':
case 'postcode':
case 'provinceFk':
case 'email': case 'email':
param = `c.${param}`; param = `c.${param}`;
return {[param]: {like: `%${value}%`}}; return {[param]: {like: `%${value}%`}};
@ -134,24 +146,29 @@ module.exports = Self => {
c.fi, c.fi,
c.socialName, c.socialName,
c.phone, c.phone,
a.phone,
c.mobile, c.mobile,
c.city, c.city,
a.city,
c.postcode, c.postcode,
a.postalCode,
c.email, c.email,
c.isActive, c.isActive,
c.isFreezed, c.isFreezed,
p.id AS provinceFk, p.id AS provinceClientFk,
a.provinceFk AS provinceAddressFk,
p.name AS province, p.name AS province,
u.id AS salesPersonFk, u.id AS salesPersonFk,
u.name AS salesPerson u.name AS salesPerson
FROM client c FROM client c
LEFT JOIN account.user u ON u.id = c.salesPersonFk LEFT JOIN account.user u ON u.id = c.salesPersonFk
LEFT JOIN province p ON p.id = c.provinceFk LEFT JOIN province p ON p.id = c.provinceFk
JOIN vn.address a ON a.clientFk = c.id JOIN address a ON a.clientFk = c.id
` `
); );
stmt.merge(conn.makeWhere(filter.where)); stmt.merge(conn.makeWhere(filter.where));
stmt.merge('GROUP BY c.id');
stmt.merge(conn.makePagination(filter)); stmt.merge(conn.makePagination(filter));
const clientsIndex = stmts.push(stmt) - 1; const clientsIndex = stmts.push(stmt) - 1;

View File

@ -34,9 +34,9 @@
"foreignKey": "stateFk" "foreignKey": "stateFk"
}, },
"user": { "user": {
"type": "belongsTo", "type": "belongsTo",
"model": "VnUser", "model": "VnUser",
"foreignKey": "userFk" "foreignKey": "workerFk"
} }
} }
} }

View File

@ -37,9 +37,9 @@
"foreignKey": "stateFk" "foreignKey": "stateFk"
}, },
"user": { "user": {
"type": "belongsTo", "type": "belongsTo",
"model": "VnUser", "model": "VnUser",
"foreignKey": "userFk" "foreignKey": "userFk"
} }
} }
} }