From e4046880428b204f3ab9b2e3d50c59c22ff2dbb6 Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 18 Jun 2024 10:12:22 +0200 Subject: [PATCH 1/3] refs #7407 create models --- modules/worker/back/model-config.json | 6 +++ .../worker/back/models/medical-center.json | 19 +++++++ .../worker/back/models/medical-review.json | 52 +++++++++++++++++++ modules/worker/back/models/worker.json | 7 ++- 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 modules/worker/back/models/medical-center.json create mode 100644 modules/worker/back/models/medical-review.json diff --git a/modules/worker/back/model-config.json b/modules/worker/back/model-config.json index b7c355511..7090cfce6 100644 --- a/modules/worker/back/model-config.json +++ b/modules/worker/back/model-config.json @@ -124,6 +124,12 @@ }, "Locker": { "dataSource": "vn" + }, + "MedicalReview": { + "dataSource": "vn" + }, + "MedicalCenter": { + "dataSource": "vn" } } diff --git a/modules/worker/back/models/medical-center.json b/modules/worker/back/models/medical-center.json new file mode 100644 index 000000000..5f0a3bbd7 --- /dev/null +++ b/modules/worker/back/models/medical-center.json @@ -0,0 +1,19 @@ +{ + "name": "MedicalCenter", + "base": "VnModel", + "options": { + "mysql": { + "table": "medicalCenter" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string" + } + } +} diff --git a/modules/worker/back/models/medical-review.json b/modules/worker/back/models/medical-review.json new file mode 100644 index 000000000..6fe7d7a01 --- /dev/null +++ b/modules/worker/back/models/medical-review.json @@ -0,0 +1,52 @@ +{ + "name": "MedicalReview", + "base": "VnModel", + "options": { + "mysql": { + "table": "medicalReview" + } + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "workerFk": { + "type": "number" + }, + "centerFk": { + "type": "number" + }, + "date": { + "type": "date" + }, + "time": { + "type": "string" + }, + "isFit": { + "type": "boolean" + }, + "amount": { + "type": "number" + }, + "invoice": { + "type": "string" + }, + "remark": { + "type": "string" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "center": { + "type": "belongsTo", + "model": "MedicalCenter", + "foreignKey": "centerFk" + } + } +} diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 4796c6373..cd7a55223 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -115,6 +115,11 @@ "type": "hasMany", "model": "Locker", "foreignKey": "workerFk" + }, + "medicalReview": { + "type": "hasMany", + "model": "MedicalReview", + "foreignKey": "workerFk" } }, "acls": [ @@ -126,4 +131,4 @@ "principalId": "$owner" } ] -} \ No newline at end of file +} From 774d55d4ae2407a12f477648bad634607b67b2fb Mon Sep 17 00:00:00 2001 From: carlossa Date: Tue, 18 Jun 2024 13:28:21 +0200 Subject: [PATCH 2/3] refs #7407 fix acls fixtures --- db/dump/fixtures.before.sql | 9 +++++++++ db/versions/11108-redRose/00-firstScript.sql | 6 ++++++ 2 files changed, 15 insertions(+) create mode 100644 db/versions/11108-redRose/00-firstScript.sql diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 058c5cd2a..ad4bf086e 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -3882,3 +3882,12 @@ INSERT INTO `vn`.`calendarHolidays` (calendarHolidaysTypeFk, dated, calendarHoli (1, '2001-05-17', 1, 5), (1, '2001-05-18', 1, 5); +INSERT INTO vn.medicalReview +(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) +VALUES(1, 1106, 1, '2000-01-01', '08:10', 1, 200.0, NULL, ''); +INSERT INTO vn.medicalReview +(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) +VALUES(2, 1106, 2, '2001-01-01', '09:10', 0, 10.0, NULL, NULL); +INSERT INTO vn.medicalReview +(id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) +VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL); diff --git a/db/versions/11108-redRose/00-firstScript.sql b/db/versions/11108-redRose/00-firstScript.sql new file mode 100644 index 000000000..e70291e8f --- /dev/null +++ b/db/versions/11108-redRose/00-firstScript.sql @@ -0,0 +1,6 @@ +-- Place your SQL code here +INSERT INTO salix.ACL (model, property, accessType, permission, principalType, principalId) + VALUES + ('MedicalReview', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('MedicalCenter', '*', '*', 'ALLOW', 'ROLE', 'hr'), + ('Worker', '__get__medicalReview', '*', 'ALLOW', 'ROLE', 'hr'); From ebdd6bd08c443e6e6a837d197f11ef1b1b4138e9 Mon Sep 17 00:00:00 2001 From: alexm Date: Mon, 1 Jul 2024 11:50:20 +0200 Subject: [PATCH 3/3] fix merge dev --- modules/worker/back/models/worker.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index 1d0b390e9..855d77e39 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -118,7 +118,8 @@ }, "medicalReview": { "type": "hasMany", - "model": "MedicalReview" + "model": "MedicalReview", + "foreignKey": "workerFk" }, "incomes": { "type": "hasMany",