feat: refs #7119 add 'id' filter option and enhance bank policy model with dmsFk field
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2025-01-24 10:46:35 +01:00
parent f8e4561a59
commit 3fba81b41e
2 changed files with 9 additions and 5 deletions

View File

@ -69,13 +69,14 @@ module.exports = Self => {
switch (param) { switch (param) {
case 'search': case 'search':
return {or: [{'v.id': value}, {numberPlate: {like: `%${value}%`}}]}; return {or: [{'v.id': value}, {numberPlate: {like: `%${value}%`}}]};
case 'id':
return {'v.id': value};
case 'description': case 'description':
case 'tradeMark': case 'tradeMark':
case 'numberPlate': case 'numberPlate':
case 'chassis': case 'chassis':
case 'leasing': case 'leasing':
return {[param]: {like: `%${value}%`}}; return {[param]: {like: `%${value}%`}};
case 'id':
case 'companyFk': case 'companyFk':
case 'warehouseFk': case 'warehouseFk':
case 'countryCodeFk': case 'countryCodeFk':
@ -83,9 +84,9 @@ module.exports = Self => {
case 'vehicleTypeFk': case 'vehicleTypeFk':
return {[param]: value}; return {[param]: value};
} }
}) || {}; });
const myFilter = mergeFilters(filter, {where}); filter = mergeFilters(filter, {where});
const stmt = new ParameterizedSQL(` const stmt = new ParameterizedSQL(`
SELECT v.id, SELECT v.id,
@ -116,9 +117,9 @@ module.exports = Self => {
) sub ON sub.vehicleFk = v.id AND sub.rn = 1 ) sub ON sub.vehicleFk = v.id AND sub.rn = 1
`); `);
const sqlWhere = conn.makeWhere(myFilter.where); const sqlWhere = conn.makeWhere(filter.where);
stmt.merge(sqlWhere); stmt.merge(sqlWhere);
stmt.merge(conn.makePagination(myFilter)); stmt.merge(conn.makePagination(filter));
const sql = ParameterizedSQL.join([stmt], ';'); const sql = ParameterizedSQL.join([stmt], ';');

View File

@ -13,6 +13,9 @@
}, },
"ref": { "ref": {
"type": "string" "type": "string"
},
"dmsFk": {
"type": "number"
} }
} }
} }