diff --git a/back/model-config.json b/back/model-config.json index d7c5410ad..15725b9aa 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -40,5 +40,8 @@ }, "Sip": { "dataSource": "vn" - } + }, + "PersonMedia": { + "dataSource": "vn" + } } \ No newline at end of file diff --git a/back/models/person-media.json b/back/models/person-media.json new file mode 100644 index 000000000..1fa316602 --- /dev/null +++ b/back/models/person-media.json @@ -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" + } + } +} diff --git a/services/db/export-data.sh b/services/db/export-data.sh index 7c7fae704..b937c72e3 100755 --- a/services/db/export-data.sh +++ b/services/db/export-data.sh @@ -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 \ No newline at end of file diff --git a/services/db/install/changes/1.2-CHECK/10-ACL.sql b/services/db/install/changes/1.2-CHECK/10-ACL.sql deleted file mode 100644 index d06afe80f..000000000 --- a/services/db/install/changes/1.2-CHECK/10-ACL.sql +++ /dev/null @@ -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'); diff --git a/services/db/install/changes/1.2-CHECK/15-personMedia.sql b/services/db/install/changes/1.2-CHECK/15-personMedia.sql new file mode 100644 index 000000000..2d517f478 --- /dev/null +++ b/services/db/install/changes/1.2-CHECK/15-personMedia.sql @@ -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'); diff --git a/services/db/install/dump/fixtures.sql b/services/db/install/dump/fixtures.sql index f5b8f4b75..7ba8ac3f8 100644 --- a/services/db/install/dump/fixtures.sql +++ b/services/db/install/dump/fixtures.sql @@ -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'); \ No newline at end of file + (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); + +