Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good Details

This commit is contained in:
Carlos Jimenez Ruiz 2019-05-23 10:01:37 +02:00
commit 736cef1ebe
28 changed files with 3809 additions and 3458 deletions

View File

@ -1,3 +0,0 @@
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
VALUES
(160, 'TicketServiceType', '*', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,76 +0,0 @@
DROP function IF EXISTS `vn`.`clientGetSalesPerson`;
DELIMITER $$
CREATE DEFINER=`root`@`%` FUNCTION `vn`.`clientGetSalesPerson`(vClientFk INT, vDated DATE) RETURNS int(11)
DETERMINISTIC
BEGIN
/**
* Dado un id cliente y una fecha, devuelve su comercial para ese dia, teniendo
* en cuenta la jerarquía de las tablas: 1º la de sharingClient, 2º la de
* sharingCart y tercero la de clientes.
*
* @param vClientFk El id del cliente
* @param vDated Fecha a comprobar
* @return El id del comercial para la fecha dada
**/
DECLARE vSalesperson INT DEFAULT NULL;
DECLARE vSubstitute INT DEFAULT NULL;
DECLARE vLoop BOOLEAN;
-- Obtiene el comercial original y el de sharingClient
SELECT c.salesPersonFk, s.workerFk
INTO vSalesperson, vSubstitute
FROM client c
LEFT JOIN sharingClient s
ON c.id = s.clientFk
AND vDated BETWEEN s.started AND s.ended
WHERE c.id = vClientFk
ORDER BY s.id
LIMIT 1;
-- Si no hay ninguno en sharingClient busca en sharingCart
IF vSubstitute IS NOT NULL
THEN
SET vSalesperson = vSubstitute;
ELSEIF vSalesperson IS NOT NULL
THEN
DROP TEMPORARY TABLE IF EXISTS tmp.stack;
CREATE TEMPORARY TABLE tmp.stack
(INDEX (substitute))
ENGINE = MEMORY
SELECT vSalesperson substitute;
l: LOOP
SELECT workerSubstitute INTO vSubstitute
FROM sharingCart
WHERE vDated BETWEEN started AND ended
AND workerFk = vSalesperson
ORDER BY id
LIMIT 1;
IF vSubstitute IS NULL THEN
LEAVE l;
END IF;
SELECT COUNT(*) > 0 INTO vLoop
FROM tmp.stack WHERE substitute = vSubstitute;
IF vLoop THEN
LEAVE l;
END IF;
INSERT INTO tmp.stack SET
substitute = vSubstitute;
SET vSalesperson = vSubstitute;
END LOOP;
DROP TEMPORARY TABLE tmp.stack;
END IF;
RETURN vSalesperson;
END$$
DELIMITER ;

View File

@ -1 +0,0 @@
ALTER TABLE `vn2008`.`Greuges` CHANGE COLUMN `Fecha` `Fecha` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ;

View File

@ -1,9 +0,0 @@
ALTER TABLE `vn2008`.`Facturas`
DROP FOREIGN KEY `invoice_bank_id`;
ALTER TABLE `vn2008`.`Facturas`
CHANGE COLUMN `Id_Banco` `Id_Banco` INT(11) NULL DEFAULT NULL ;
ALTER TABLE `vn2008`.`Facturas`
ADD CONSTRAINT `invoice_bank_id`
FOREIGN KEY (`Id_Banco`)
REFERENCES `vn2008`.`Bancos` (`Id_Banco`)
ON UPDATE CASCADE;

View File

@ -1,13 +0,0 @@
ALTER TABLE `vn2008`.`Colas`
DROP FOREIGN KEY `Colas_ibfk_1`,
DROP FOREIGN KEY `Colas_ibfk_2`,
DROP FOREIGN KEY `Colas_ibfk_3`,
DROP FOREIGN KEY `Colas_ibfk_5`;
ALTER TABLE `vn2008`.`Colas`
CHANGE COLUMN `Id_Impresora` `Id_Impresora` TINYINT(3) UNSIGNED NULL DEFAULT NULL ,
CHANGE COLUMN `Id_Prioridad` `Id_Prioridad` TINYINT(3) UNSIGNED NULL DEFAULT NULL ;
ALTER TABLE `vn2008`.`Colas`
ADD CONSTRAINT `Colas_ibfk_3`
FOREIGN KEY (`Id_Prioridad`)
REFERENCES `vn2008`.`Prioridades` (`Id_Prioridad`)
ON UPDATE CASCADE;

View File

@ -1,21 +0,0 @@
DROP TABLE IF EXISTS `vn`.`routeLog`;
CREATE TABLE `vn`.`routeLog` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`originFk` int(10) unsigned NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`description` text CHARACTER SET utf8,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci,
`newInstance` text COLLATE utf8_unicode_ci,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `routeLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn2008`.`Rutas` (`Id_Ruta`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `routeLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -1,14 +0,0 @@
CREATE
ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`sharingCart` AS
SELECT
`s`.`id` AS `id`,
`s`.`Id_Trabajador` AS `workerFk`,
`s`.`datSTART` AS `started`,
`s`.`datEND` AS `ended`,
`s`.`Id_Suplente` AS `workerSubstitute`,
`s`.`odbc_date` AS `created`
FROM
`vn2008`.`sharingcart` `s`

View File

@ -1,13 +0,0 @@
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`sharingClient` AS
SELECT
`s`.`id` AS `id`,
`s`.`Id_Trabajador` AS `workerFk`,
`s`.`datSTART` AS `started`,
`s`.`datEND` AS `ended`,
`s`.`Id_Cliente` AS `clientFk`
FROM
`vn2008`.`sharingclient` `s`;

View File

@ -1,4 +0,0 @@
DROP TABLE IF EXISTS `vn`.`ticketConfig`;
CREATE TABLE `vn`.`ticketConfig` (`id` INT NOT NULL AUTO_INCREMENT, `scopeDays` TINYINT(3) NULL, PRIMARY KEY (`id`));
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`) VALUES ('1', '6');

View File

@ -1,74 +0,0 @@
DROP procedure IF EXISTS `vn`.`ticketCreateWithUser`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`ticketCreateWithUser`(
vClientId INT
,vShipped DATE
,vWarehouseId INT
,vCompanyFk INT
,vAddressFk INT
,vAgencyType INT
,vRouteFk INT
,vlanded DATE
,vUserId INT
,OUT vNewTicket INT)
BEGIN
IF vClientId IS NULL THEN
CALL util.throw ('CLIENT_NOT_ESPECIFIED');
END IF;
IF NOT vAddressFk OR vAddressFk IS NULL THEN
SELECT id INTO vAddressFk
FROM address
WHERE clientFk = vClientId AND isDefaultAddress;
END IF;
INSERT INTO vn2008.Tickets (
Id_Cliente,
Fecha,
Id_Consigna,
Id_Agencia,
Alias,
warehouse_id,
Id_Ruta,
empresa_id,
landing
)
SELECT
vClientId,
vShipped,
a.id,
IF(vAgencyType, vAgencyType, a.agencyModeFk),
a.nickname,
vWarehouseId,
IF(vRouteFk,vRouteFk,NULL),
vCompanyFk,
vlanded
FROM address a
JOIN agencyMode am ON am.id = a.agencyModeFk
WHERE a.id = vAddressFk;
SET vNewTicket = LAST_INSERT_ID();
INSERT INTO ticketObservation(ticketFk, observationTypeFk, description)
SELECT vNewTicket, ao.observationTypeFk, ao.description
FROM addressObservation ao
JOIN address a ON a.id = ao.addressFk
WHERE a.id = vAddressFk;
-- CALL logAddWithUser(vNewTicket, vUserId, 'insert', 'ticket', CONCAT('Ha creado el ticket', ' ', vNewTicket));
INSERT INTO vn.ticketLog
SET originFk = vNewTicket, userFk = vUserId, `action` = 'insert', description = CONCAT('Ha creado el ticket:', ' ', vNewTicket);
IF (SELECT ct.isCreatedAsServed FROM vn.clientType ct JOIN vn.client c ON c.typeFk = ct.code WHERE c.id = vClientId ) <> FALSE THEN
INSERT INTO vncontrol.inter(state_id, Id_Ticket, Id_Trabajador)
SELECT id, vNewTicket, getWorker()
FROM state
WHERE `code` = 'DELIVERED';
END IF;
END$$
DELIMITER ;

View File

@ -1,13 +0,0 @@
DROP TABLE IF EXISTS `vn`.`ticketServiceType`;
CREATE TABLE vn.`ticketServiceType` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Lista de los posibles servicios a elegir';
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Agencia');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Portes Retorno');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Porte Carry');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Cargo FITOSANITARIO');
INSERT INTO `vn`.`ticketServiceType` (`name`) VALUES ('Documentos');

View File

@ -1,46 +0,0 @@
DROP procedure IF EXISTS `vn`.`worker_getHierarch`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `vn`.`worker_getHierarch`(vBoss INT)
BEGIN
DECLARE EXIT HANDLER FOR 1062 BEGIN
CALL util.throw('INFINITE_LOOP');
END;
DROP TEMPORARY TABLE IF EXISTS workerHierarch;
CREATE TEMPORARY TABLE workerHierarch
(PRIMARY KEY (workerFk))
ENGINE = MEMORY
SELECT vBoss AS workerFk;
DROP TEMPORARY TABLE IF EXISTS tmp.workerHierarchList;
CREATE TEMPORARY TABLE tmp.workerHierarchList
(PRIMARY KEY (workerFk))
ENGINE = MEMORY
SELECT vBoss AS workerFk, 0 AS isChecked;
WHILE (SELECT COUNT(*) FROM tmp.workerHierarchList WHERE NOT isChecked) > 0 DO
INSERT INTO tmp.workerHierarchList
SELECT w.id, 0
FROM worker w
JOIN workerHierarch wh ON wh.workerFk = w.bossFk;
UPDATE tmp.workerHierarchList whl
JOIN workerHierarch wh ON wh.workerFk = whl.workerFk
SET whl.isChecked = 1;
TRUNCATE workerHierarch;
INSERT INTO workerHierarch
SELECT workerFk
FROM tmp.workerHierarchList
WHERE NOT isChecked;
END WHILE;
DROP TEMPORARY TABLE IF EXISTS workerHierarch;
END$$
DELIMITER ;

View File

@ -1,6 +0,0 @@
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (161, 'TicketConfig', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (162, 'InvoiceOut', 'delete', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (163, 'InvoiceOut', 'book', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (164, 'InvoiceOut', 'regenerate', 'WRITE', 'ALLOW', 'ROLE', 'invoicing');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (165, 'TicketDms', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
INSERT INTO `salix`.`ACL` (`id`, `model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES (166, 'Dms', 'download', 'READ', 'ALLOW', 'ROLE', 'employee');

View File

@ -1,20 +0,0 @@
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`dms` AS
SELECT
`g`.`id` AS `id`,
`g`.`gesttip_id` AS `dmsTypeFk`,
`g`.`file` AS `file`,
`g`.`trabajador_id` AS `workerFk`,
`g`.`warehouse_id` AS `warehouseFk`,
`g`.`emp_id` AS `companyFk`,
`g`.`orden` AS `priority`,
`g`.`file` AS `hasFile`,
`g`.`sref` AS `reference`,
`g`.`brief` AS `description`,
`g`.`odbc_date` AS `created`
FROM
`vn2008`.`gestdoc` `g`

View File

@ -1,71 +0,0 @@
DROP procedure IF EXISTS `nst`.`nodeAdd`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeAdd`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vParentFk` INT, IN `vChild` VARCHAR(100))
BEGIN
DECLARE vSql TEXT;
DECLARE vTableClone VARCHAR(45);
SET vTableClone = CONCAT(vTable, 'Clone');
CALL util.exec(CONCAT('DROP TEMPORARY TABLE IF EXISTS tmp.', vTableClone));
CALL util.exec(CONCAT(
'CREATE TEMPORARY TABLE tmp.', vTableClone,
' ENGINE = MEMORY',
' SELECT * FROM ', vScheme, '.', vTable
));
CALL util.exec(CONCAT(
'SELECT COUNT(c.id) INTO @childs',
' FROM ', vScheme, '.', vTable, ' p',
' LEFT JOIN tmp.', vTableClone, ' c ON c.lft',
' BETWEEN p.lft AND p.rgt AND c.id != ', vParentFk,
' WHERE p.id = ', vParentFk
));
IF @childs = 0 THEN
CALL util.exec(CONCAT(
'SELECT lft INTO @vLeft',
' FROM ', vScheme, '.', vTable,
' WHERE id = ', vParentFk
));
ELSE
CALL util.exec(CONCAT(
'SELECT c.rgt INTO @vLeft',
' FROM ', vScheme, '.', vTable, ' p',
' JOIN tmp.', vTableClone, ' c ON c.lft BETWEEN p.lft AND p.rgt',
' WHERE p.id = ', vParentFk,
' ORDER BY c.lft',
' DESC LIMIT 1'
));
END IF;
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt + 2',
' WHERE rgt > @vLeft',
' ORDER BY rgt DESC'
));
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET lft = lft + 2',
' WHERE lft > @vLeft',
' ORDER BY lft DESC'
));
SET vChild = REPLACE(vChild, "'", "\\'");
CALL util.exec(CONCAT(
'INSERT INTO ', vScheme, '.', vTable, ' (name, lft, rgt)',
' VALUES ("', vChild, '", @vLeft + 1, @vLeft + 2)'
));
CALL util.exec(CONCAT(
'SELECT id, name, lft, rgt, depth, sons',
' FROM ', vScheme, '.', vTable,
' WHERE id = LAST_INSERT_ID()'
));
CALL util.exec(CONCAT('DROP TEMPORARY TABLE tmp.', vTableClone));
END$$
DELIMITER ;

View File

@ -1,34 +0,0 @@
DROP procedure IF EXISTS `nst`.`nodeDelete`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeDelete`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45), IN `vNodeId` INT)
BEGIN
DECLARE vMyRight INT;
DECLARE vMyLeft INT;
DECLARE vMyWidth INT;
CALL util.exec(CONCAT(
'SELECT t.rgt, t.lft, t.rgt - t.lft + 1',
' INTO @vMyRight, @vMyLeft, @vMyWidth',
' FROM ', vScheme, '.', vTable, ' t',
' WHERE t.id = ', vNodeId
));
CALL util.exec(CONCAT(
'DELETE FROM ', vScheme, '.', vTable,
' WHERE lft BETWEEN @vMyLeft AND @vMyRight'
));
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET rgt = rgt - @vMyWidth'
' WHERE rgt > @vMyRight ORDER BY rgt'
));
CALL util.exec(CONCAT(
'UPDATE ', vScheme, '.', vTable, ' SET lft = lft - @vMyWidth'
' WHERE lft > @vMyRight ORDER BY lft'
));
END$$
DELIMITER ;

View File

@ -1,23 +0,0 @@
DROP procedure IF EXISTS `nst`.`nodeRecalc`;
DELIMITER $$
CREATE DEFINER=`root`@`%` PROCEDURE `nst`.`nodeRecalc`(IN `vScheme` VARCHAR(45), IN `vTable` VARCHAR(45))
BEGIN
CALL util.exec(CONCAT (
'UPDATE ', vScheme, '.', vTable, ' d',
' JOIN (SELECT',
' node.id,',
' COUNT(parent.id) - 1 as depth,',
' cast((node.rgt - node.lft - 1) / 2 as DECIMAL) as sons',
' FROM ',
' ', vScheme, '.', vTable, ' AS node,',
' ', vScheme, '.', vTable, ' AS parent',
' WHERE node.lft BETWEEN parent.lft AND parent.rgt',
' GROUP BY node.id',
' ORDER BY node.lft) n ON n.id = d.id ',
' SET d.`depth` = n.depth, d.sons = n.sons'
));
END$$
DELIMITER ;

View File

@ -1,12 +0,0 @@
DROP VIEW IF EXISTS `vn`.`dmsTicket` ;
USE `vn`;
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`ticketDms` AS
SELECT
`g`.`Id_Ticket` AS `ticketFk`,
`g`.`gestdoc_id` AS `dmsFk`
FROM
`vn2008`.`tickets_gestdoc` `g`;

View File

@ -1,7 +0,0 @@
ALTER TABLE `vn2008`.`gesttip`
ADD COLUMN `writeRoleFk` INT(10) UNSIGNED NULL AFTER `path`,
ADD COLUMN `readRoleFk` INT(10) UNSIGNED NULL AFTER `writeRoleFk`,
ADD CONSTRAINT `readRoleFk` FOREIGN KEY (`readRoleFk`) REFERENCES `account`.`role` (`id`),
ADD CONSTRAINT `writeRoleFk` FOREIGN KEY (`writeRoleFk`) REFERENCES `account`.`role` (`id`);
UPDATE `vn2008`.`gesttip` SET `readRoleFk`='1' WHERE `id`='14';

View File

@ -1,13 +0,0 @@
CREATE
OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%`
SQL SECURITY DEFINER
VIEW `vn`.`dmsType` AS
SELECT
`g`.`id` AS `id`,
`g`.`tipo` AS `name`,
`g`.`path` AS `path`,
`g`.`readRoleFk` AS `readRoleFk`,
`g`.`writeRoleFk` AS `writeRoleFk`
FROM
`vn2008`.`gesttip` `g`;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,10 @@
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1;
INSERT INTO `vn`.`ticketConfig` (`id`, `scopeDays`)
VALUES
('1', '6');
INSERT INTO `account`.`mailConfig` (`id`, `domain`)
VALUES
('1', 'verdnatura.es');
@ -1435,7 +1439,7 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`)
(2, 'Doc oficial', '\oficial', NULL, NULL),
(3, 'Laboral', '\laboral', NULL, NULL),
(4, 'Albaranes recibidos', '\entradas', NULL, NULL),
(5, 'Otros', '\otros', NULL, NULL),
(5, 'Otros', '\otros', 1, NULL),
(6, 'Pruebas', '\pruebas', NULL, NULL),
(7, 'IAE Clientes', '\IAE_Clientes', NULL, NULL),
(8, 'Fiscal', '\fiscal', NULL, NULL),
@ -1453,8 +1457,8 @@ INSERT INTO `vn`.`dmsType`(`id`, `name`, `path`, `readRoleFk`, `writeRoleFk`)
INSERT INTO `vn`.`dms`(`id`, `dmsTypeFk`, `file`, `workerFk`, `warehouseFk`, `companyFk`, `hardCopyNumber`, `hasFile`, `reference`, `description`, `created`)
VALUES
(1, 14, 'filename.pdf', 5, 1, 442, NULL, 1, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()),
(2, 5, 'filename2.pdf', 5, 1, 442, NULL, 1, 'Client:101', 'Client:101 dms for the client', CURDATE());
(1, 14, '1.pdf', 5, 1, 442, NULL, FALSE, 'Ticket:11', 'Ticket:11 dms for the ticket', CURDATE()),
(2, 5, '2.pdf', 5, 1, 442, 1, TRUE, 'Client:101', 'Client:101 dms for the client', CURDATE());
INSERT INTO `vn`.`ticketDms`(`ticketFk`, `dmsFk`)
VALUES

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Ticket descriptor path', () => {
fdescribe('Ticket descriptor path', () => {
const nightmare = createNightmare();
beforeAll(() => {

View File

@ -149,6 +149,8 @@ function e2eOnly() {
if (argv.show || argv.s)
process.env.E2E_SHOW = true;
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true;
const specFiles = [
`${__dirname}/e2e/paths/**/*[sS]pec.js`,

View File

@ -7,7 +7,7 @@ describe('Client activeWorkersWithRole', () => {
let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson');
expect(result.length).toEqual(11);
expect(result.length).toEqual(12);
expect(isSalesPerson).toBeTruthy();
});

View File

@ -91,5 +91,8 @@
},
"TpvTransaction": {
"dataSource": "vn"
},
"ClientDms": {
"dataSource": "vn"
}
}

View File

@ -0,0 +1,38 @@
{
"name": "ClientDms",
"base": "Loggable",
"log": {
"model": "ClientLog",
"relation": "ticket",
"showField": "dmsFk"
},
"options": {
"mysql": {
"table": "clientDms"
}
},
"properties": {
"clientFk": {
"type": "Number",
"id": true,
"required": true
},
"dmsFk": {
"type": "Number",
"id": true,
"required": true
}
},
"relations": {
"client": {
"type": "belongsTo",
"model": "Client",
"foreignKey": "clientFk"
},
"dms": {
"type": "belongsTo",
"model": "Dms",
"foreignKey": "dmsFk"
}
}
}