diff --git a/back/model-config.json b/back/model-config.json index 537ffb569..365749507 100644 --- a/back/model-config.json +++ b/back/model-config.json @@ -37,6 +37,9 @@ }, "UserConfigView": { "dataSource": "vn" + }, + "EmailUser": { + "dataSource": "vn" } } diff --git a/back/models/account.json b/back/models/account.json index c3b8c38d7..ad0c8aa5d 100644 --- a/back/models/account.json +++ b/back/models/account.json @@ -46,9 +46,14 @@ "type": "belongsTo", "model": "Role", "foreignKey": "roleFk" + }, + "emailUser": { + "type": "hasOne", + "model": "EmailUser", + "foreignKey": "userFk" } }, - "acls": [ + "acls": [ { "property": "login", "accessType": "EXECUTE", diff --git a/back/models/emailUser.json b/back/models/emailUser.json new file mode 100644 index 000000000..d612d5d29 --- /dev/null +++ b/back/models/emailUser.json @@ -0,0 +1,27 @@ +{ + "name": "EmailUser", + "base": "VnModel", + "options": { + "mysql": { + "table": "account.emailUser" + } + }, + "properties": { + "userFk": { + "id": true, + "type": "Number", + "required": true + }, + "email": { + "type": "string", + "required": true + } + }, + "relations": { + "user": { + "type": "belongsTo", + "model": "Account", + "foreignKey": "userFk" + } + } +} diff --git a/db/install/changes/17-mailUser.sql b/db/install/changes/17-mailUser.sql new file mode 100644 index 000000000..8f45aae1d --- /dev/null +++ b/db/install/changes/17-mailUser.sql @@ -0,0 +1,12 @@ +CREATE + ALGORITHM = UNDEFINED + DEFINER = `root`@`%` + SQL SECURITY DEFINER +VIEW `account`.`emailUser` AS + SELECT + `u`.`id` AS `userFk`, + CONCAT(`u`.`name`, '@', `mc`.`domain`) AS `email` + FROM + + (`account`.`user` `u` + JOIN `account`.`mailConfig` `mc`) \ No newline at end of file diff --git a/db/install/dump/fixtures.sql b/db/install/dump/fixtures.sql index b623e6f84..3d867bdbe 100644 --- a/db/install/dump/fixtures.sql +++ b/db/install/dump/fixtures.sql @@ -7,7 +7,7 @@ INSERT INTO `util`.`config` ( `dbVersion`, `hasTriggersDisabled`, `environment`) VALUES ('1.0.0', '0', 'development'); INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`) - SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@verdnatura.es') + SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com') FROM `account`.`role`; INSERT INTO `vn2008`.`Trabajadores`(`Id_Trabajador`,`CodigoTrabajador`, `Nombre`, `Apellidos`, `user_id`) @@ -18,16 +18,16 @@ DELETE FROM `vn`.`worker` where name ='customer'; INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lang`) VALUES - (101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'BruceWayne@verdnatura.es', 'es'), - (102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'PetterParker@verdnatura.es', 'es'), - (103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'ClarkKent@verdnatura.es', 'es'), - (104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'TonyStark@verdnatura.es', 'es'), - (105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'MaxEisenhardt@verdnatura.es', 'es'), - (106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'DavidCharlesHaller@verdnatura.es', 'es'), - (107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'HankPym@verdnatura.es', 'es'), - (108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 20, 1, 'CharlesXavier@verdnatura.es', 'es'), - (109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'BruceBanner@verdnatura.es', 'es'), - (110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1 , 1, 'JessicaJones@verdnatura.es', 'es'), + (101, 'BruceWayne', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'BruceWayne@mydomain.com', 'es'), + (102, 'PetterParker', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'PetterParker@mydomain.com', 'es'), + (103, 'ClarkKent', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'ClarkKent@mydomain.com', 'es'), + (104, 'TonyStark', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'TonyStark@mydomain.com', 'es'), + (105, 'MaxEisenhardt', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'MaxEisenhardt@mydomain.com', 'es'), + (106, 'DavidCharlesHaller', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'DavidCharlesHaller@mydomain.com', 'es'), + (107, 'HankPym', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'HankPym@mydomain.com', 'es'), + (108, 'CharlesXavier', 'ac754a330530832ba1bf7687f577da91', 20, 1, 'CharlesXavier@mydomain.com', 'es'), + (109, 'BruceBanner', 'ac754a330530832ba1bf7687f577da91', 2 , 1, 'BruceBanner@mydomain.com', 'es'), + (110, 'JessicaJones', 'ac754a330530832ba1bf7687f577da91', 1 , 1, 'JessicaJones@mydomain.com', 'es'), (111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es'), (112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es'); @@ -191,21 +191,21 @@ INSERT INTO `vn`.`contactChannel`(`id`, `name`) INSERT INTO `vn`.`client`(`id`,`name`,`fi`,`socialName`,`contact`,`street`,`city`,`postcode`,`phone`,`mobile`,`fax`,`isRelevant`,`email`,`iban`,`dueDay`,`accountingAccount`,`isEqualizated`,`provinceFk`,`hasToInvoice`,`credit`,`countryFk`,`isActive`,`gestdocFk`,`quality`,`payMethodFk`,`created`,`isToBeMailed`,`contactChannelFk`,`hasSepaVnl`,`hasCoreVnl`,`hasCoreVnh`,`riskCalculated`,`clientTypeFk`,`mailAddress`,`cplusTerIdNifFk`,`hasToInvoiceByAddress`,`isTaxDataChecked`,`isFreezed`,`creditInsurance`,`isCreatedAsServed`,`hasInvoiceSimplified`,`salesPersonFk`,`isVies`,`eypbc`) VALUES - (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), - (102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 18, 0, 1), - (103, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (104, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), - (105, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, NULL, 0, 1), - (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), - (107, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), - (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), - (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 19, 0, 1), - (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@verdnatura.es', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, NULL, 0, 1), + (101, 'Bruce Wayne', '84612325V', 'Batman', 'Alfred', '1007 Mountain Drive, Gotham', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceWayne@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 18, 0, 1), + (102, 'Petter Parker', '87945234L', 'Spider-Man', 'Aunt May', '20 Ingram Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'PetterParker@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 18, 0, 1), + (103, 'Clark Kent', '06815934E', 'Super-Man', 'lois lane', '344 Clinton Street', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'ClarkKent@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 0, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (104, 'Tony Stark', '06089160W', 'Iron-Man', 'Pepper Potts', '10880 Malibu Point', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'TonyStark@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 18, 0, 1), + (105, 'Max Eisenhardt', '39182496H', 'Magneto', 'Rogue', 'Unknown Whereabouts', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'MaxEisenhardt@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, NULL, 0, 1), + (106, 'DavidCharlesHaller', '53136686Q', 'Legion', 'Charles Xavier', 'Evil hideout', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'DavidCharlesHaller@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 0,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 0, NULL, 0, 0, 19, 0, 1), + (107, 'Hank Pym', '09854837G', 'Ant-Man', 'Hawk', 'Anthill', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'HankPym@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 0, NULL, 0, 0, 19, 0, 1), + (108, 'Charles Xavier', '22641921P', 'Professor X', 'Beast', '3800 Victory Pkwy, Cincinnati, OH 45207, USA', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'CharlesXavier@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 1, 1, NULL, 0, 0, 19, 0, 1), + (109, 'Bruce Banner', '16104829E', 'Hulk', 'Black widow', 'Somewhere in New York', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'BruceBanner@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, 19, 0, 1), + (110, 'Jessica Jones', '58282869H', 'Jessica Jones', 'Luke Cage', 'NYCC 2015 Poster', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, 'JessicaJones@mydomain.com', NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 1, NULL, 1, 1, 0, 1, NULL, 0, 0, NULL, 0, 1), (200, 'Missing', NULL, 'Missing man', 'Anton', 'The space', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1), (400, 'Trash', NULL, 'Garbage man', 'Unknown name', 'New York city', 'Silla', 46460, 1111111111, 222222222, 333333333, 1, NULL, NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5,CURDATE(), 1, 5, 1, 1, 1,'0000-00-00', 4, NULL, 1, 0, 1, 0, NULL, 1, 0, NULL, 0, 1); INSERT INTO `vn`.`client`(`id`, `name`, `fi`, `socialName`, `contact`, `street`, `city`, `postcode`, `phone`, `isRelevant`, `email`, `iban`,`dueDay`,`accountingAccount`, `isEqualizated`, `provinceFk`, `hasToInvoice`, `credit`, `countryFk`, `isActive`, `gestdocFk`, `quality`, `payMethodFk`,`created`, `isTaxDataChecked`) - SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 623111111, 1, CONCAT(name,'@verdnatura.es'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 + SELECT id, name, CONCAT(RPAD(CONCAT(id,9),8,id),'A'), CONCAT(name, 'Social'), CONCAT(name, 'Contact'), CONCAT(name, 'Street'), 'SILLA', 46460, 623111111, 1, CONCAT(name,'@mydomain.com'), NULL, 0, 1234567890, 0, 1, 1, 300, 1, 1,NULL, 10, 5, CURDATE(), 1 FROM `account`.`role` `r` WHERE `r`.`hasLogin` = 1; @@ -459,7 +459,7 @@ INSERT INTO `vn`.`vehicle`(`id`, `numberPlate`, `tradeMark`, `model`, `companyFk INSERT INTO `vn`.`config`(`id`, `mdbServer`, `fakeEmail`, `defaultersMaxAmount`) VALUES - (1, 'beta-server', 'nightmare@verdnatura.es', '200'); + (1, 'beta-server', 'nightmare@mydomain.com', '200'); INSERT INTO `vn`.`greugeType`(`id`, `name`) VALUES @@ -1211,3 +1211,6 @@ INSERT INTO `postgresql`.`business_labour`(`business_id`, `notes`, `department_i VALUES (1, NULL, 22, 4, 0, 1, 1, 1, 1), (2, 'From las friday worker ownes the company 1 hour', 23, 1, 0, 1, 0, 1, 1); + +INSERT INTO `account`.`mailConfig` (`id`, `domain`) VALUES ('1', 'verdnatura.es'); + diff --git a/modules/worker/back/methods/worker/filter.js b/modules/worker/back/methods/worker/filter.js index ff9068d56..961abf291 100644 --- a/modules/worker/back/methods/worker/filter.js +++ b/modules/worker/back/methods/worker/filter.js @@ -107,13 +107,14 @@ module.exports = Self => { stmt = new ParameterizedSQL( `SELECT w.id, u.email, p.extension, u.name as userName, - d.name AS department, w.name, u.nickname + d.name AS department, w.name, u.nickname, mu.email FROM worker w LEFT JOIN workerDepartment wd ON wd.workerFk = w.id LEFT JOIN department d ON d.id = wd.departmentFk LEFT JOIN client c ON c.id = w.userFk LEFT JOIN account.user u ON u.id = w.userFk - LEFT JOIN pbx.sip p ON p.user_id = u.id` + LEFT JOIN pbx.sip p ON p.user_id = u.id + LEFT JOIN account.emailUser mu ON mu.userFk = u.id` ); diff --git a/modules/worker/front/card/index.js b/modules/worker/front/card/index.js index fe8a57fb9..5e1e33510 100644 --- a/modules/worker/front/card/index.js +++ b/modules/worker/front/card/index.js @@ -18,7 +18,15 @@ class Controller { include: [ { relation: 'user', - scope: {fields: ['name', 'email']} + scope: { + fields: ['name'], + include: { + relation: 'emailUser', + scope: { + fields: ['email'] + } + } + } }, { relation: 'sip', diff --git a/modules/worker/front/descriptor-popover/index.js b/modules/worker/front/descriptor-popover/index.js index 0df83ae45..cd8916ec5 100644 --- a/modules/worker/front/descriptor-popover/index.js +++ b/modules/worker/front/descriptor-popover/index.js @@ -45,14 +45,25 @@ class Controller extends Component { include: [ { relation: 'user', - scope: {fields: ['name', 'email']} - }, { + scope: { + fields: ['name'], + include: { + relation: 'emailUser', + scope: { + fields: ['email'] + } + } + } + }, + { relation: 'client', scope: {fields: ['fi']} - }, { + }, + { relation: 'sip', scope: {fields: ['extension']} - }, { + }, + { relation: 'department', scope: { include: { diff --git a/modules/worker/front/descriptor-popover/index.spec.js b/modules/worker/front/descriptor-popover/index.spec.js index c0267c397..d6c04e9e7 100644 --- a/modules/worker/front/descriptor-popover/index.spec.js +++ b/modules/worker/front/descriptor-popover/index.spec.js @@ -65,7 +65,15 @@ describe('worker Component vnWorkerDescriptorPopover', () => { include: [ { relation: 'user', - scope: {fields: ['name', 'email']} + scope: { + fields: ['name'], + include: { + relation: 'emailUser', + scope: { + fields: ['email'] + } + } + } }, { relation: 'client', scope: {fields: ['fi']} diff --git a/modules/worker/front/descriptor/index.html b/modules/worker/front/descriptor/index.html index 37c70fb5a..5bb9b22e5 100644 --- a/modules/worker/front/descriptor/index.html +++ b/modules/worker/front/descriptor/index.html @@ -21,7 +21,7 @@ title="{{$ctrl.worker.firstName}} {{$ctrl.worker.lastName}}"> + value="{{$ctrl.worker.user.emailUser.email}}"> diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 703c82edd..d6e42ddd1 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -42,7 +42,7 @@ value="{{::worker.userName}}"> + value="{{::worker.email}}"> diff --git a/modules/worker/front/summary/index.html b/modules/worker/front/summary/index.html index d5c423fab..9dd0a15b6 100644 --- a/modules/worker/front/summary/index.html +++ b/modules/worker/front/summary/index.html @@ -7,7 +7,7 @@ value="{{worker.id}}"> + value="{{worker.user.emailUser.email}}"> diff --git a/modules/worker/front/summary/index.js b/modules/worker/front/summary/index.js index 9a69a1ea1..24656d601 100644 --- a/modules/worker/front/summary/index.js +++ b/modules/worker/front/summary/index.js @@ -23,11 +23,19 @@ class Controller { { relation: 'user', scope: { - fields: ['name', 'email', 'roleFk'], - include: { + fields: ['name', 'roleFk'], + include: [{ relation: 'role', - scope: {fields: ['name']} - } + scope: { + fields: ['name'] + } + }, + { + relation: 'emailUser', + scope: { + fields: ['email'] + } + }] } }, { relation: 'client',