feat: refs #7119 add VehicleNotes model and update vehicle filter SQL query
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Jorge Penadés 2024-12-30 17:55:27 +01:00
parent 68e42206c8
commit bc495ed51e
3 changed files with 39 additions and 1 deletions

View File

@ -118,7 +118,7 @@ module.exports = Self => {
SELECT e.vehicleFk,
e.vehicleStateFk,
s.state,
ROW_NUMBER() OVER (PARTITION BY e.vehicleFk ORDER BY e.started DESC) as rn
ROW_NUMBER() OVER (PARTITION BY e.vehicleFk ORDER BY e.started DESC) rn
FROM vehicleEvent e
LEFT JOIN vehicleState s ON e.vehicleStateFk = s.id
) sub ON sub.vehicleFk = v.id AND sub.rn = 1

View File

@ -47,6 +47,9 @@
"VehicleEvent": {
"dataSource": "vn"
},
"VehicleNotes": {
"dataSource": "vn"
},
"VehicleState": {
"dataSource": "vn"
},

View File

@ -0,0 +1,35 @@
{
"name": "VehicleNotes",
"base": "VnModel",
"options": {
"mysql": {
"table": "vehicleNotes"
}
},
"properties": {
"id": {
"type": "number",
"id": true
},
"vehicleFk": {
"type": "number"
},
"created": {
"type": "date"
},
"note": {
"type": "string"
},
"userFk": {
"type": "number"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "delivery",
"permission": "ALLOW"
}
]
}