new model and fixtures for PersonMedia #996 cau 9477

This commit is contained in:
Bernat 2019-01-24 07:36:26 +01:00
parent 2673a36578
commit fa9918d22c
6 changed files with 71 additions and 26 deletions

View File

@ -40,5 +40,8 @@
},
"Sip": {
"dataSource": "vn"
}
},
"PersonMedia": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,25 @@
{
"name": "PersonMedia",
"base": "VnModel",
"options": {
"mysql": {
"table": "personMedia"
}
},
"properties": {
"mediaValue": {
"type": "String"
},
"workerFk": {
"id": true,
"type": "Number"
}
},
"relations": {
"worker": {
"type": "belongsTo",
"model": "Worker",
"foreignKey": "workerFk"
}
}
}

View File

@ -14,3 +14,5 @@ echo "USE \`cache\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info cache cache >> install/dump/dumpedFixtures.sql
echo "USE \`hedera\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info hedera tpvError tpvResponse tpvConfig >> install/dump/dumpedFixtures.sql
echo "USE \`postgresql\`;" >> install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info postgresql profile_type media_type >> install/dump/dumpedFixtures.sql

View File

@ -1,24 +0,0 @@
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('CreditClassification', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('ClientObservation', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES('ItemTag', '*', 'WRITE', 'ALLOW', 'ROLE', 'marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (104,'Item','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (105,'ItemBarcode','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (106,'ItemBotanical','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (107,'ItemNiche','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (108,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (19,'ItemPlacement','*','WRITE','ALLOW','ROLE','marketingBoss');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (59,'CreditInsurance','*','READ','ALLOW','ROLE','employee');
DELETE FROM `salix`.`ACL` WHERE `id`='67';
DELETE FROM `salix`.`ACL` WHERE `id`='74';
DELETE FROM `salix`.`ACL` WHERE `id`='92';
DELETE FROM `salix`.`ACL` WHERE `id`='93';
DELETE FROM `salix`.`ACL` WHERE `id`='95';
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (133,'TicketLog', '*','READ', 'ALLOW','ROLE','employee');
INSERT INTO `salix`.`ACL`(`id`,`model`,`property`,`accessType`,`permission`,`principalType`,`principalId`) VALUES (134,'TicketService', '*','*', 'ALLOW','ROLE','employee');

View File

@ -0,0 +1,17 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `personMedia` AS
SELECT
`p`.`id_trabajador` AS `workerFk`,
`m`.`value` AS `mediaValue`
FROM
((((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`)))
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`)))
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`)))
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`)))
WHERE
(`mt`.`name` = 'movil empresa');

View File

@ -1086,4 +1086,26 @@ INSERT INTO `pbx`.`sip`(`user_id`, `extension`, `secret`, `caller_id`)
(1, 1010, '123456', 'employee'),
(3, 1101, '123456', 'agency'),
(5, 1102, '123456', 'administrative'),
(9, 1201, '123456', 'developer');
(9, 1201, '123456', 'developer');
INSERT INTO `postgresql`.`person`(`person_id`, `name`, `nickname`, `nif`, `firstname`, `id_trabajador`)
VALUES
(1, 'Haller', 'DavidCharlesHaller', '53136686Q', 'David Charles', 106 ),
(2, 'Pym', 'HankPym', '09854837G', 'Hank', 107);
INSERT INTO `postgresql`.`profile`(`profile_id`, `person_id`, `profile_type_id`)
VALUES
(1, 1, 1),
(2, 2, 1);
INSERT INTO `postgresql`.`media`(`media_id`, `media_type_id`, `value`, `sort`)
VALUES
(1, 10, 600123321, 0),
(2, 10, 700987987, 0);
INSERT INTO `postgresql`.`profile_media`(`profile_media_id`, `profile_id`, `media_id`)
VALUES
(1, 1, 1),
(2, 2, 2);