feat: refs #7119 add VehicleState model with data source configuration #3328

Merged
jorgep merged 37 commits from 7119-createVehicle into dev 2025-02-06 09:24:11 +00:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit 3fba81b41e - Show all commits

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"
} }
} }
} }