create models saleChecked saleComponent, added fixtures and ACL

This commit is contained in:
Bernat Exposito 2018-03-14 12:06:21 +01:00
parent 6df5f1c3fa
commit 60f3bfc7b8
7 changed files with 135 additions and 1 deletions

View File

@ -415,6 +415,29 @@ INSERT INTO `vn`.`sale`(`id`, `itemFk`, `ticketFk`, `concept`, `quantity`, `pric
( 2, 1, 1, 'Gem of Time', 2 , 1.5, 0, 0, 0, CURDATE()),
( 3, 2, 2, 'Mjolnir' , 10, 4 , 0, 0, 0, CURDATE());
INSERT INTO `vn`.`saleChecked`(`saleFk`, `isChecked`)
VALUES
( 1, 0),
( 2, 1);
INSERT INTO `vn`.`componentTypeRate`(`id`, `type`)
VALUES
( 1, 'agency'),
( 2, 'client'),
( 3, 'company');
INSERT INTO `vn`.`componentRate`(`id`, `name`, `componentTypeRate`, `classRate`, `tax`, `isRenewable`)
VALUES
( 1, 'Special price', 1, NULL, NULL, 1),
( 2, 'Delivery', 2, NULL, NULL, 1),
( 3, 'Mana', 3, 1, NULL, 0 );
INSERT INTO `vn`.`saleComponent`(`saleFk`, `componentFk`, `value`)
VALUES
( 1, 1, 0.5),
( 2, 2, 1.2 );
INSERT INTO `vn`.`itemBarcode`(`id`, `itemFk`, `code`)
VALUES
(1, 1 ,1 ),

View File

@ -7,3 +7,5 @@ INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `pri
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('TicketPackaging', '*', '*', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Packaging', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('Packaging', '*', 'WRITE', 'ALLOW', 'ROLE', 'logistic');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SaleChecked', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('SaleComponent', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -0,0 +1,11 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`saleChecked` AS
SELECT
`m`.`Id_Movimiento` AS `saleFk`,
`m`.`checked` AS `isChecked`
FROM
`vn2008`.`Movimientos_checked` `m`;

View File

@ -0,0 +1,39 @@
{
"name": "ComponentRate",
"base": "VnModel",
"options": {
"mysql": {
"table": "componentRate"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"description": "Identifier"
},
"name": {
"type": "String"
},
"classRate": {
"type": "Number"
},
"tax": {
"type": "Number"
},
"isRenewable": {
"type": "Number"
},
"componentTypeRate": {
"type": "Number"
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}

View File

@ -0,0 +1,24 @@
{
"name": "SaleChecked",
"base": "VnModel",
"options": {
"mysql": {
"table": "saleChecked"
}
},
"properties": {
"isChecked": {
"type": "Number"
},
"saleFk": {
"id": true
}
},
"relations": {
"sale": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleFk"
}
}
}

View File

@ -0,0 +1,29 @@
{
"name": "SaleComponent",
"base": "VnModel",
"options": {
"mysql": {
"table": "saleComponent"
}
},
"properties": {
"value": {
"type": "Number"
},
"saleFk": {
"id": true
}
},
"relations": {
"sale": {
"type": "belongsTo",
"model": "Sale",
"foreignKey": "saleFk"
},
"componentRate": {
"type": "belongsTo",
"model": "componentRate",
"foreignKey": "componentFk"
}
}
}

View File

@ -16,5 +16,11 @@
},
"Packaging": {
"dataSource": "vn"
},
"SaleChecked": {
"dataSource": "vn"
}
}