From 921edb238cdb1eb700e46429f6ec3db3846c0d85 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 27 Dec 2024 16:55:59 +0100 Subject: [PATCH] feat: refs #7119 add Ppe model and establish relationships in Vehicle model --- db/dump/fixtures.before.sql | 49 ++++++++++++++------------ modules/route/back/model-config.json | 3 ++ modules/route/back/models/ppe.json | 23 ++++++++++++ modules/route/back/models/vehicle.json | 6 ++++ 4 files changed, 59 insertions(+), 22 deletions(-) create mode 100644 modules/route/back/models/ppe.json diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index b2d11999d..d5562d000 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -4051,31 +4051,36 @@ INSERT IGNORE INTO vn.inventoryConfig supplierFk = 4; INSERT INTO vn.vehicleState (state, hasToNotify) -VALUES - ('Operativo', NULL), - ('Prestado', NULL), - ('Robado', NULL), - ('Taller', NULL), - ('Targeta SOLRED', NULL), - ('Via T SOLRED', NULL), - ('ITV', NULL); + VALUES + ('Operativo', NULL), + ('Prestado', NULL), + ('Robado', NULL), + ('Taller', NULL), + ('Targeta SOLRED', NULL), + ('Via T SOLRED', NULL), + ('ITV', NULL); INSERT INTO vn.vehicleEvent (started, finished, vehicleStateFk, description, vehicleFk, userFk, notified) -VALUES - ('2000-12-01', '2000-12-02', 4, 'cambio de aceite', 5, 103, NULL), - ('2000-12-15', '2000-12-18', 2, 'viaje fin de curso', 5, 103, NULL), - ('2000-12-20', '2001-01-01', 3, 'llaves puestas', 2, 103, NULL); + VALUES + ('2000-12-01', '2000-12-02', 4, 'cambio de aceite', 5, 103, NULL), + ('2000-12-15', '2000-12-18', 2, 'viaje fin de curso', 5, 103, NULL), + ('2000-12-20', '2001-01-01', 3, 'llaves puestas', 2, 103, NULL); INSERT INTO vn.fuelType (id, name, code) -VALUES - (1, 'gasoil', 'gasoil'), - (2, 'gas', 'gas'), - (3, 'adblue', 'adblue'), - (4, 'gasolina', 'gasolina'), - (5, 'gasoil-frigo', 'gasoil-frigo'), - (6, 'electrico', 'electric'); + VALUES + (1, 'gasoil', 'gasoil'), + (2, 'gas', 'gas'), + (3, 'adblue', 'adblue'), + (4, 'gasolina', 'gasolina'), + (5, 'gasoil-frigo', 'gasoil-frigo'), + (6, 'electrico', 'electric'); INSERT INTO vn.bankPolicy (id, `ref`, amount, committedFee, nonCommittedFee, annualFee, started, ended, accountingFk, companyFk, supplierFk, description, hasGuarantee, dmsFk, notaryFk, currencyFk, amortizationTypeFk, periodicityTypeFk, insuranceExpired) -VALUES - (1, '11112222', 500000.0, 0.028, 0.0, 0.001, '2001-01-01', '2001-02-01', 1, 442, NULL, NULL, 0, NULL, NULL, 1, NULL, NULL, NULL), - (2, '33334444', 100000.0, 0.017, 0.0, 0.0, '2001-01-01', '2001-02-01', 1, 2, NULL, NULL, 0, NULL, NULL, 2, NULL, NULL, NULL); \ No newline at end of file + VALUES + (1, '11112222', 500000.0, 0.028, 0.0, 0.001, '2001-01-01', '2001-02-01', 1, 442, NULL, NULL, 0, NULL, NULL, 1, NULL, NULL, NULL), + (2, '33334444', 100000.0, 0.017, 0.0, 0.0, '2001-01-01', '2001-02-01', 1, 2, NULL, NULL, 0, NULL, NULL, 2, NULL, NULL, NULL); + +INSERT INTO vn.ppe (id, amortization, firstAmortizated, lastAmortizated, finished, value, planFk, groupFk, account, endowment, elementAccount, nature, location, discharged, cause, isInvestmentAsset, workerFk, companyFk, description, isDone) + VALUES + (1, 0.00, '2001-01-01', NULL, NULL, 700.95, 16, 4, '3456000000', '4320000000', '12345', 'INMOVILIZADO', 'V02', NULL, NULL, 0, NULL, 442, 'UTILLAJE LASER ROTATIVO AUTONIVELANTE 500M', NULL), + (2, 0.00, '2001-01-01', NULL, NULL, 400.00, 16, 4, '5678000000', '1230000000', '67891', 'INMOVILIZADO', 'V02', NULL, NULL, 0, NULL, 442, 'UTILLAJE BALANZA Z100 150KILOS', NULL); \ No newline at end of file diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json index 42b71f5f1..c8c67a361 100644 --- a/modules/route/back/model-config.json +++ b/modules/route/back/model-config.json @@ -17,6 +17,9 @@ "FuelType": { "dataSource": "vn" }, + "Ppe": { + "dataSource": "vn" + }, "RoadmapAddress": { "dataSource": "vn" }, diff --git a/modules/route/back/models/ppe.json b/modules/route/back/models/ppe.json new file mode 100644 index 000000000..7af5cb684 --- /dev/null +++ b/modules/route/back/models/ppe.json @@ -0,0 +1,23 @@ +{ + "name": "Ppe", + "base": "VnModel", + "options": { + "mysql": { + "table": "ppe" + } + }, + "properties": { + "id": { + "type": "number", + "id": true + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "delivery", + "permission": "ALLOW" + } + ] +} \ No newline at end of file diff --git a/modules/route/back/models/vehicle.json b/modules/route/back/models/vehicle.json index c5b6eab5b..dbf78f7d1 100644 --- a/modules/route/back/models/vehicle.json +++ b/modules/route/back/models/vehicle.json @@ -93,6 +93,12 @@ "type": "belongsTo", "model": "FuelType", "foreignKey": "fuelTypeFk" + }, + "ppe": { + "type": "hasOne", + "model": "Ppe", + "foreignKey": "id", + "property": "ppeFk" } }, "scope": {