From 82f58c8bc0ecbd7ddc6157658053993e472c6de9 Mon Sep 17 00:00:00 2001 From: Bernat Date: Tue, 30 Oct 2018 09:43:17 +0100 Subject: [PATCH] create new model morwerTeam --- .../db/install/changes/1.2-CHECK/10-ACL.sql | 1 + services/db/install/dump/fixtures.sql | 11 ++++++- .../loopback/common/models/worker-team.json | 31 +++++++++++++++++++ services/loopback/server/model-config.json | 5 ++- 4 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 services/db/install/changes/1.2-CHECK/10-ACL.sql create mode 100644 services/loopback/common/models/worker-team.json diff --git a/services/db/install/changes/1.2-CHECK/10-ACL.sql b/services/db/install/changes/1.2-CHECK/10-ACL.sql new file mode 100644 index 000000000..04548b327 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/10-ACL.sql @@ -0,0 +1 @@ +INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (118, 'WorkerTeam', '*', '*', 'ALLOW', 'role', 'salesPerson'); diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index 65b2c5853..e33fae53f 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -1008,4 +1008,13 @@ INSERT INTO `vn`.`receipt`(`id`, `invoiceFk`, `amountPaid`, `amountUnpaid`, `pay (1, 'Cobro web', 100.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), (2, 'Cobro web', 200.50, 0.00, CURDATE(), 9, 1, 101, CURDATE(), 442, 1), (3, 'Cobro en efectivo', 300.00, 100.00, CURDATE(), 9, 1, 102, CURDATE(), 442, 0), - (4, 'Cobro en efectivo', 400.00, -50.00, CURDATE(), 9, 1, 103, CURDATE(), 442, 0); \ No newline at end of file + (4, 'Cobro en efectivo', 400.00, -50.00, CURDATE(), 9, 1, 103, CURDATE(), 442, 0); + +INSERT INTO `vn2008`.`workerTeam`(`id`, `team`, `user`) + VALUES + (1, 1, 9), + (2, 1, 18), + (3, 2, 101), + (4, 2, 102), + (5, 3, 103), + (6, 3, 104); \ No newline at end of file diff --git a/services/loopback/common/models/worker-team.json b/services/loopback/common/models/worker-team.json new file mode 100644 index 000000000..e3f607d3e --- /dev/null +++ b/services/loopback/common/models/worker-team.json @@ -0,0 +1,31 @@ +{ + "name": "WorkerTeam", + "base": "VnModel", + "options": { + "mysql": { + "table": "workerTeam" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "team": { + "type": "Number" + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + }, + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "Id_Trabajador" + } + } +} \ No newline at end of file diff --git a/services/loopback/server/model-config.json b/services/loopback/server/model-config.json index 75976f22d..47a46c412 100644 --- a/services/loopback/server/model-config.json +++ b/services/loopback/server/model-config.json @@ -140,5 +140,8 @@ }, "ClaimRatio": { "dataSource": "vn" + }, + "WorkerTeam": { + "dataSource": "vn" } -} +} \ No newline at end of file