diff --git a/back/models/country.json b/back/models/country.json index c9523e8a3..bf8486b4a 100644 --- a/back/models/country.json +++ b/back/models/country.json @@ -1,39 +1,39 @@ { - "name": "Country", - "description": "Worldwide countries", - "base": "VnModel", - "options": { - "mysql": { - "table": "country" - } - }, - "properties": { - "id": { - "type": "Number", - "id": true, - "description": "Identifier" + "name": "Country", + "description": "Worldwide countries", + "base": "VnModel", + "options": { + "mysql": { + "table": "country" + } }, - "country": { - "type": "string", - "required": true + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "country": { + "type": "string", + "required": true + }, + "code": { + "type": "string" + } }, - "code": { - "type": "string" - } - }, - "relations": { - "currency": { - "type": "belongsTo", - "model": "Currency", - "foreignKey": "currencyFk" - } - }, - "acls": [ - { - "accessType": "READ", - "principalType": "ROLE", - "principalId": "$everyone", - "permission": "ALLOW" - } - ] + "relations": { + "currency": { + "type": "belongsTo", + "model": "Currency", + "foreignKey": "currencyFk" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] } \ No newline at end of file diff --git a/db/install/changes/0-ACL.sql b/db/install/changes/0-ACL.sql index 3fd811372..e5bfe3bd1 100644 --- a/db/install/changes/0-ACL.sql +++ b/db/install/changes/0-ACL.sql @@ -1,4 +1,4 @@ --- INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (149, 'Sip', '*', 'WRITE', 'ALLOW', 'ROLE', 'hr'); --- INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (150, 'Sip', '*', 'READ', 'ALLOW', 'ROLE', 'employee'); --- INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (151, 'Department','*','READ','ALLOW','ROLE','employee'); --- INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (152, 'Department','*','WRITE','ALLOW','ROLE','hr'); +INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (151, 'Department','*','READ','ALLOW','ROLE','employee'); +INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (152, 'Department','*','WRITE','ALLOW','ROLE','hr'); +INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (153, 'Route','*','READ','ALLOW','ROLE','employee'); +INSERT INTO `salix`.`ACL` (`id`,`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (154, 'Route','*','WRITE','ALLOW','ROLE','delivery'); diff --git a/db/install/dump/fixtures.sql b/db/install/dump/fixtures.sql index aba603956..266f8f448 100644 --- a/db/install/dump/fixtures.sql +++ b/db/install/dump/fixtures.sql @@ -353,15 +353,15 @@ INSERT INTO `vn`.`creditInsurance`(`id`, `creditClassification`, `credit`, `crea (2, 2 , 6000, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL), (3, 3, 10000 , DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL); -INSERT INTO `vn`.`route`(`id`, `created`) +INSERT INTO `vn`.`route`(`id`, `created`, `workerFk`, `vehicleFk`, `isOk`, `description`) VALUES - (1, CURDATE()), - (2, CURDATE()), - (3, CURDATE()), - (4, CURDATE()), - (5, CURDATE()), - (6, CURDATE()), - (7, CURDATE()); + (1, CURDATE(), 56, 1, 0, 'first route' ), + (2, CURDATE(), 56, 1, 0, 'second route' ), + (3, CURDATE(), 56, 2, 0, 'third route' ), + (4, CURDATE(), 56, 3, 0, 'fourth route' ), + (5, CURDATE(), 56, 4, 0, 'fifth route' ), + (6, CURDATE(), 57, 5, 0, 'sixth route' ), + (7, CURDATE(), 57, 6, 0, 'seventh route'); INSERT INTO `vn2008`.`empresa_grupo`(`empresa_grupo_id`, `grupo`) VALUES @@ -459,7 +459,7 @@ INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk (3, '2222-IMK', 'STARK INDUSTRIES', 'MARK-VI', 442, 1, 'Iron-Man Heavy Armor MARK-VI', 16, 1), (4, '3333-IMK', 'STARK INDUSTRIES', 'MARK-VII', 442, 1, 'Iron-Man Heavy Armor MARK-VII', 14, 1), (5, '4444-IMK', 'STARK INDUSTRIES', 'MARK-XLII', 442, 1, 'Iron-Man Heavy Armor MARK-XLII', 13, 1), - (6, '5555-IMK', 'STARK INDUSTRIES', 'MARK-XLV', 442, 1, 'Iron-Man Heavy Armor MARK-XLV', 12, 1); + (6, '5555-IMK', 'STARK INDUSTRIES', 'MARK-XLV', 442, 1, 'Iron-Man Heavy Armor MARK-XLV', 12, 0); INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`) VALUES diff --git a/modules/route/back/model-config.json b/modules/route/back/model-config.json new file mode 100644 index 000000000..6e667134a --- /dev/null +++ b/modules/route/back/model-config.json @@ -0,0 +1,8 @@ +{ + "Route": { + "dataSource": "vn" + }, + "Vehicle": { + "dataSource": "vn" + } +} diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json new file mode 100644 index 000000000..afe078b3a --- /dev/null +++ b/modules/route/back/models/route.json @@ -0,0 +1,69 @@ +{ + "name": "Route", + "base": "VnModel", + "options": { + "mysql": { + "table": "route" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "created": { + "type": "date" + }, + "time": { + "type": "date" + }, + "isOk": { + "type": "Number" + }, + "kmStart": { + "type": "Number" + }, + "kmEnd": { + "type": "Number" + }, + "started": { + "type": "date" + }, + "finished": { + "type": "date" + }, + "gestdoc": { + "type": "date", + "mysql": { + "columnName": "gestdocFk" + } + }, + "cost": { + "type": "Number" + }, + "m3": { + "type": "Number" + }, + "description": { + "type": "String" + } + }, + "relations": { + "worker": { + "type": "belongsTo", + "model": "Worker", + "foreignKey": "workerFk" + }, + "vehicle": { + "type": "belongsTo", + "model": "Vehicle", + "foreignKey": "vehicleFk" + }, + "agencyMode": { + "type": "belongsTo", + "model": "AgencyMode", + "foreignKey": "agencyModeFk" + } + } +} diff --git a/modules/route/back/models/vehicle.json b/modules/route/back/models/vehicle.json new file mode 100644 index 000000000..e35e18a57 --- /dev/null +++ b/modules/route/back/models/vehicle.json @@ -0,0 +1,54 @@ +{ + "name": "Vehicle", + "base": "VnModel", + "options": { + "mysql": { + "table": "vehicle" + } + }, + "properties": { + "id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "numberPlate": { + "type": "String" + }, + "tradeMark": { + "type": "String" + }, + "model": { + "type": "String" + }, + "m3": { + "type": "Number" + }, + "description": { + "type": "String" + }, + "isActive": { + "type": "Number" + } + }, + "relations": { + "company": { + "type": "belongsTo", + "model": "Company", + "foreignKey": "companyFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + } + }, + "acls": [ + { + "accessType": "READ", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" + } + ] +}