cau 9995 - 10013 fix test and update structure
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-03-04 08:13:09 +01:00
parent 7d04404053
commit 02f99d3eb2
34 changed files with 1437 additions and 1202 deletions

7
db/connect.tpl.ini Normal file
View File

@ -0,0 +1,7 @@
[client]
enable_cleartext_plugin = ON
host = localhost
port = 3306
user = root
password = password
ssl-mode = DISABLED

View File

@ -1,5 +1,4 @@
#!/bin/bash
#IMPORTANT Any changes in this file are to applyed to mirror file export-data.cmd
echo "USE \`account\`;" > install/dump/dumpedFixtures.sql
mysqldump --defaults-file=connect.ini --no-create-info account role roleRole roleInherit >> install/dump/dumpedFixtures.sql
echo "USE \`salix\`;" >> install/dump/dumpedFixtures.sql

View File

@ -11,8 +11,7 @@ BEGIN
UPDATE Consignatarios SET predeterminada = FALSE
WHERE Id_cliente = NEW.Id_cliente;
UPDATE Consignatarios SET predeterminada = TRUE
WHERE Id_consigna = NEW.default_address;
END IF;
END$$
DELIMITER ;

View File

@ -1,7 +1,7 @@
USE `account`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: account
-- Host: test-db.verdnatura.es Database: account
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -55,11 +55,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:26
-- Dump completed on 2019-03-01 13:31:23
USE `salix`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: salix
-- Host: test-db.verdnatura.es Database: salix
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -103,11 +103,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:26
-- Dump completed on 2019-03-01 13:31:23
USE `vn`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: vn
-- Host: test-db.verdnatura.es Database: vn
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -201,11 +201,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:26
-- Dump completed on 2019-03-01 13:31:23
USE `vn2008`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: vn2008
-- Host: test-db.verdnatura.es Database: vn2008
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -399,11 +399,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:27
-- Dump completed on 2019-03-01 13:31:24
USE `bi`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: bi
-- Host: test-db.verdnatura.es Database: bi
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -447,11 +447,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:27
-- Dump completed on 2019-03-01 13:31:24
USE `cache`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: cache
-- Host: test-db.verdnatura.es Database: cache
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -485,11 +485,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:27
-- Dump completed on 2019-03-01 13:31:24
USE `hedera`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: hedera
-- Host: test-db.verdnatura.es Database: hedera
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -543,11 +543,11 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:27
-- Dump completed on 2019-03-01 13:31:24
USE `postgresql`;
-- MySQL dump 10.13 Distrib 5.7.21, for osx10.13 (x86_64)
--
-- Host: db.verdnatura.es Database: postgresql
-- Host: test-db.verdnatura.es Database: postgresql
-- ------------------------------------------------------
-- Server version 5.6.25-4-log
@ -618,7 +618,7 @@ UNLOCK TABLES;
LOCK TABLES `workcenter` WRITE;
/*!40000 ALTER TABLE `workcenter` DISABLE KEYS */;
INSERT INTO `workcenter` VALUES (1,'Silla',20,861,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL);
INSERT INTO `workcenter` VALUES (1,'Silla',20,865,1),(2,'Mercaflor',19,NULL,NULL),(3,'Marjales',26,20006,NULL),(4,'VNH',NULL,NULL,3),(5,'Madrid',28,2843,5),(6,'Vilassar',88,88014,2),(7,'Tenerife',NULL,NULL,10),(8,'Silla-Agrario',26,NULL,NULL);
/*!40000 ALTER TABLE `workcenter` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -631,4 +631,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-02-25 8:31:27
-- Dump completed on 2019-03-01 13:31:24

View File

@ -1,3 +1,5 @@
ALTER TABLE `vn`.`itemTaxCountry` AUTO_INCREMENT = 1;
ALTER TABLE `vn2008`.`Consignatarios` AUTO_INCREMENT = 1;
@ -8,7 +10,7 @@ INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@verdnatura.es')
FROM `account`.`role`;
INSERT INTO `vn`.`worker`(`id`,`workerCode`, `firstName`, `name`, `userFk`)
INSERT INTO `vn2008`.`Trabajadores`(`Id_Trabajador`,`CodigoTrabajador`, `Nombre`, `Apellidos`, `user_id`)
SELECT id,UPPER(LPAD(role, 3, '0')), name, name, id
FROM `vn`.`user`;
@ -29,7 +31,7 @@ INSERT INTO `account`.`user`(`id`,`name`,`password`,`role`,`active`,`email`,`lan
(111, 'Missing', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es'),
(112, 'Trash', 'ac754a330530832ba1bf7687f577da91', 2 , 0, NULL, 'es');
INSERT INTO `vn`.`worker`(`workerCode`, `id`, `firstName`, `name`, `userFk`)
INSERT INTO `vn2008`.`Trabajadores`(`CodigoTrabajador`, `Id_Trabajador`, `Nombre`, `Apellidos`, `user_id`)
VALUES
('LGN', 106, 'David Charles', 'Haller', 106),
('ANT', 107, 'Hank' , 'Pym' , 107),
@ -294,15 +296,15 @@ INSERT INTO `vn`.`clientCreditLimit`(`id`, `maxAmount`, `roleFk`)
INSERT INTO `vn`.`clientObservation`(`id`, `clientFk`, `workerFk`, `text`, `created`)
VALUES
(1, 101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()),
(2, 102, 1, 'With great power, comes great responsibility', CURDATE()),
(3, 103, 3, 'this is a job for Super-Man!', CURDATE()),
(4, 104, 3, 'yes... I am Iron-Man', CURDATE()),
(5, 105, 5, 'They do understand. Our mutant powers make us superior', CURDATE()),
(6, 106, 5, 'My name is Legion, for we are many!', CURDATE()),
(7, 107, 9, 'I think our first move should be calling the Avengers..', CURDATE()),
(8, 108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()),
(9, 109, 20, 'HULK SMASH! ...', CURDATE()),
(1, 101, 1, 'Madness, as you know, is like gravity, all it takes is a little push', CURDATE()),
(2, 102, 1, 'With great power, comes great responsibility', CURDATE()),
(3, 103, 3, 'this is a job for Super-Man!', CURDATE()),
(4, 104, 3, 'yes... I am Iron-Man', CURDATE()),
(5, 105, 5, 'They do understand. Our mutant powers make us superior', CURDATE()),
(6, 106, 5, 'My name is Legion, for we are many!', CURDATE()),
(7, 107, 9, 'I think our first move should be calling the Avengers..', CURDATE()),
(8, 108, 9, 'Just because someone stumbles and loses their path, does not mean they are lost forever.', CURDATE()),
(9, 109, 20, 'HULK SMASH! ...', CURDATE()),
(10, 110, 20, 'They say everyone is born a hero. But if you let it, life will push you over the line until you are the villain.', CURDATE());
INSERT INTO `vn`.`observationType`(`id`,`description`)

View File

@ -18,11 +18,11 @@ let jasmine = new Jasmine();
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
let serviceSpecs = [
'./db/tests/**/*[sS]pec.js'
'./tests/**/*[sS]pec.js'
];
jasmine.loadConfig({
spec_dir: 'services',
spec_dir: 'db',
spec_files: serviceSpecs,
helpers: []
});

View File

@ -183,6 +183,7 @@ describe('ticket ticketCreateWithUser()', () => {
params.landed,
params.userId
]);
stmts.push(stmt);
let ticketAddressIndex = stmts.push(`SELECT addressFk FROM vn.ticket WHERE id = @newTicketId`) - 1;
@ -191,12 +192,9 @@ describe('ticket ticketCreateWithUser()', () => {
params.clientFk,
]);
let clientDefaultAddressIndex = stmts.push(stmt) - 1;
stmts.push('ROLLBACK');
let sql = ParameterizedSQL.join(stmts, ';');
let result = await app.models.Ticket.rawStmt(sql);
let ticketAddress = result[ticketAddressIndex][0];
let clientDefaultAddress = result[clientDefaultAddressIndex][0];

View File

@ -355,7 +355,7 @@ async function docker() {
let d = new Date();
let pad = v => v < 10 ? '0' + v : v;
let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
await execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./services/db`);
await execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./db`);
let dockerArgs = `--name ${containerId} -p 3306:${dbConf.port}`;

View File

@ -84,9 +84,9 @@
"yaml-loader": "^0.5.0"
},
"scripts": {
"dbtest": "nodemon -q services/db/tests.js -w services/db/tests",
"dbtest": "nodemon -q db/tests.js -w db/tests",
"back": "nodemon --inspect -w modules ./node_modules/gulp/bin/gulp.js back",
"lint": "eslint ./ --cache --ignore-pattern .gitignore",
"docker": "docker build -t salix-db ./services/db"
"docker": "docker build -t salix-db ./db"
}
}

View File

@ -1,5 +0,0 @@
[client]
host=localhost
port=3306
user=root
password=