feat: refs #5483 unify DB #1955

Merged
alexm merged 11 commits from 5483-unifyDb into dev 2024-01-29 05:58:54 +00:00
9 changed files with 46 additions and 49 deletions
Showing only changes of commit 81639726b2 - Show all commits

View File

@ -1,6 +1,6 @@
const path = require('path');
const Myt = require('../../myt/myt');
const Run = require('../../myt/myt-run');
const Myt = require('@verdnatura/myt/myt');
const Run = require('@verdnatura/myt/myt-run');
let dataSources = require('../loopback/server/datasources.json');
let myt;

View File

@ -4,7 +4,7 @@ USE `util`;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
INSERT INTO `version` VALUES ('salix','10230','53f69ae8e526a4a5d827c237a5b076d38507b392','2020-11-09 11:06:43',NULL);
INSERT INTO `version` VALUES ('vn-database','10818','c156178ea565d81485769882618e122d9cba5d4e','2024-01-25 10:00:48','10831');
INSERT INTO `version` VALUES ('vn-database','10818','b7edbbe12f35d0cbc3e6b83e54977ac1c8acfc74','2024-01-25 10:00:48','10831');
INSERT INTO `versionLog` VALUES ('vn-database','10107','00-firstScript.sql','jenkins@10.0.2.69','2022-04-23 10:53:53',NULL,NULL);
INSERT INTO `versionLog` VALUES ('vn-database','10112','00-firstScript.sql','jenkins@10.0.2.69','2022-05-09 09:14:53',NULL,NULL);

View File

@ -9,12 +9,12 @@ SET foreign_key_checks = 0;
INSERT INTO util.config (environment, mockTime, mockUtcTime, mockEnabled)
VALUES ('local', '2001-01-01 12:00:00', '2001-01-01 11:00:00', TRUE);
/* #5483
INSERT INTO vn.entryConfig (defaultEntry, mailToNotify, inventorySupplierFk, maxLockTime, defaultSupplierFk)
VALUES(1, NULL, 1, 300, 1);
*/
-- XXX: eti
/* #5483
INSERT INTO vn.travel (id,shipped,landed,warehouseInFk,warehouseOutFk,`ref`,m3,kg,cargoSupplierFk)
VALUES (9,'2022-05-20','2022-05-20',13,4,'nine travel',69.0,600,1);
@ -29,7 +29,7 @@ INSERT INTO vn.buy (id,entryFk,itemFk,quantity,dispatched,buyingValue,freightVal
(17,10,2,450,0,5.0,1.0,0,1,10,10,0,0.0,1.0,'3',0.0,7.3,7.0,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(18,10,15,500,0,55.0,1.0,0,1,1,1,0,0.0,1.0,'5',0.0,78.3,75.6,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5),
(19,10,11,5000,0,50.0,1.0,0,1,1,1,1,0.0,1.0,'4',0.0,99.6,99.4,0.0,0,0,1,0,'2022-06-20 00:00:00',0,2.5);
*/
INSERT INTO vn2008.Splits (Id_Split,Id_Ticket,Id_Entrada,Fecha,Notas)
VALUES
(1,7,2,'00-00-0000 00:00:00.000','nota1'),
@ -37,8 +37,6 @@ INSERT INTO vn2008.Splits (Id_Split,Id_Ticket,Id_Entrada,Fecha,Notas)
(3,15,7,'00-00-0000 00:00:00.000','nota3'),
(4,22,10,'00-00-0000 00:00:00.000','nota4');
-- XXX: ent
-- XXX: enc
INSERT INTO vn.mdbVersion (app, branchFk, version)
@ -51,17 +49,16 @@ UPDATE vn.warehouse
UPDATE vn.packaging
SET freightItemFk = 1, isBox = 1
WHERE id = '94';
/* #5483
INSERT INTO `vn`.`packagingConfig`(`upperGap`, `defaultSmallPackageFk`, `defaultBigPackageFk`)
VALUES
('10', 1, 2);
*/
UPDATE vn.packaging SET freightItemFk=1 WHERE id='1';
UPDATE vn.packaging SET freightItemFk=1 WHERE id='2';
INSERT INTO vn.packagingWithFreight (packagingFk, priority) VALUES('1', 1);
INSERT INTO vn.cmrConfig (dayOfMonth, landingDays)
VALUES(5, 1);
@ -76,8 +73,6 @@ INSERT INTO vn.cmr (id, truckPlate, observations, senderInstruccions, paymentIns
UPDATE `vn`.`claimRatio` SET `claimAmount` = '10' WHERE (`clientFk` = '1101');
UPDATE `util`.`config` SET `environment` = 'local' WHERE (`id` = '1');
INSERT INTO `vn`.`agency` (`name`, `warehouseFk`, `warehouseAliasFk`, `isOwn`, `isAnyVolumeAllowed`) VALUES
('Agencia', '1', '1', '1', '1'),
('Otra agencia ', '1', '2', '0', '0');
@ -91,11 +86,11 @@ INSERT INTO vn.client (id,name,defaultAddressFk,street,fi,email,dueDay,isTaxData
INSERT INTO vn.address (clientFk,street,city,provinceFk,postalCode,nickname,isEqualizated,isLogifloraAllowed,isDefaultAddress) VALUES
(100,'rootStreet','ALGEMESI',3,'46680','root',0,0,1);
/* #5483
INSERT INTO vn.ticket (clientFk,warehouseFk,shipped,nickname,refFk,addressFk,routeFk,companyFk,agencyModeFk,landed,zoneFk, totalWithVat, totalWithoutVat) VALUES
(100,1,'2025-07-06 00:00:00','Saco de patatas',NULL,103,6,442,1,'2025-07-06',13, 500, 450),
(100,1,'2021-07-06 00:00:00','Alubias de la abuelita Enrriqueta','T4444444',103,6,442,1,'2021-07-06',13, 1000, 900);
*/
INSERT INTO vn.receipt (invoiceFk,amountPaid,payed,workerFk,bankFk,clientFk,isConciliate,companyFk) VALUES
('Cobro mental',999.0,'2021-06-21 00:00:00',9,3,100,1,442),
('Cobro web',50.0,'2022-06-21 00:00:00',9,3,100,1,567);
@ -114,12 +109,12 @@ UPDATE vn.agencyMode
UPDATE vn.agencyMode
SET deliveryMethodFk=2
WHERE id=2;
/* #5483
INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight) VALUES
(100, 3, '2022-07-12 00:00:00', 'root', NULL, 195, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-12 16:18:58', 1, NULL, 3, NULL, 1, 567, 1, '2022-07-12', 0, 0, 5, NULL, NULL, NULL, NULL, NULL),
(100, 4, '2022-07-12 00:00:00', 'root', NULL, 195, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-12 16:18:58', 1, NULL, 4, NULL, 1, 567, 1, '2022-07-12', 0, 0, 6, NULL, NULL, NULL, NULL, NULL),
(100, 5, '2022-07-12 00:00:00', 'root', NULL, 195, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-12 16:18:58', 1, NULL, 5, NULL, 1, 567, 1, '2022-07-12', 0, 0, 1, NULL, NULL, NULL, NULL, NULL);
*/
INSERT INTO vn.sector (description,warehouseFk) VALUES
('Sector One',1);
@ -128,31 +123,27 @@ INSERT INTO vn.saleGroup (userFk,parkingFk,sectorFk) VALUES
INSERT INTO vn.saleGroupDetail (saleFk,saleGroupFk) VALUES
(32,1);
/* #5483
INSERT INTO vn.itemShelving (id,itemFk,visible,shelvingFk,`grouping`,packing,packagingFk,userFk) VALUES
(4,1,5,'HEJ',12,12,'2',100);
*/
INSERT INTO vn.beach (code,warehouseFk) VALUES
('TEST',1);
INSERT INTO vn.routesMonitor (routeFk,name,beachFk,m3,expeditionTruckFk) VALUES
(1,'TEST','TEST',1.0,1);
/* #5483
INSERT INTO vn.ticket (clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight)
VALUES (1101, 1, '2022-07-19 10:00:00', 'Bruce Wayne', NULL, 1, NULL, NULL, 0, 0, 0, 0, NULL, 0, '2022-07-19 08:14:37', 1, NULL, 1, 1, 1, 442, 1, '2022-07-06', 0, 0, 13, 5.00, 1.00, 80.00, 75.00, NULL);
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded)
VALUES (1, 24, 'Ranged weapon longbow 2m', 1.00, NULL, 8.07, 0, 0.00, 0, 0, 0, '2022-07-06 00:00:00', 0);
*/
INSERT INTO vn2008.zones (zone_id,name,printingOrder)
VALUES (1,'zone Test',1);
-- XXX: lab
INSERT INTO `hedera`.`imageConfig` (`maxSize`,`url`)
VALUES
('20', '//verdnatura.es/vn-image-data');
INSERT INTO `vn`.`businessReasonEnd` (`id`, `reason`)
VALUES
('1', 'Baja voluntaria'),
@ -249,7 +240,7 @@ INSERT INTO vn.saleGroupDetail (created, saleFk, saleGroupFk)
INSERT INTO vn.saleTracking (saleFk, isChecked, created, originalQuantity, workerFk, id, stateFk)
VALUES
(15, 1, '2022-07-29 07:56:16', 10.0, 9, 6, 26);
/* #5483
INSERT INTO vn.ticket (id, clientFk, warehouseFk, shipped, nickname, refFk, addressFk, workerFk, observations, isSigned, isLabeled, isPrinted, packages, location, `hour`, created, isBlocked, solution, routeFk, priority, hasPriority, companyFk, agencyModeFk, landed, isBoxed, isDeleted, zoneFk, zonePrice, zoneBonus, totalWithVat, totalWithoutVat, weight)
VALUES
(3000001, 1110, 1, '2022-07-28 21:00:00', 'ATELIER ART FLORAL', NULL, 129, NULL, NULL, 0, 0, 0, 1, NULL, 0, '2022-07-28 20:27:14', 1, NULL, 1, 16, 1, 442, 1, '2022-07-29', 0, 0, 1, 4.00, 0.00, 41.68, 37.42, NULL);
@ -261,7 +252,7 @@ INSERT INTO vn.collection (id, created, workerFk, stateFk, itemPackingTypeFk, sa
INSERT INTO vn.sale (itemFk, ticketFk, concept, quantity, originalQuantity, price, discount, priceFixed, reserved, isPicked, isPriceFixed, created, isAdded)
VALUES
( 1, 3000001, 'Ranged weapon longbow 2m', 5.00, NULL, 100.39, 0, 0.00, 0, 1, 0, '2022-06-13 00:00:00', 0);
*/
INSERT INTO vn.collectionColors(code, shelve, wagon, trainFk)
VALUES
( 'ROJO', 1, 1, 1);
@ -269,7 +260,7 @@ INSERT INTO vn.collectionColors(code, shelve, wagon, trainFk)
INSERT INTO vn.ticketCollection (ticketFk, collectionFk, created, `level`, wagon, smartTagFk, usedShelves, itemCount, liters)
VALUES
(3000001, 600001, '2022-07-28 20:04:24', 1, 1, NULL, NULL, 6, 122);
/* #5483
INSERT INTO vn.itemShelving (itemFk, shelvingFk, visible, created, `grouping`, packing, packagingFk, userFk, buyFk)
VALUES
( 1, 'HEJ', 4, '2022-07-13 10:33:34', 12, 12, NULL, 9 , 1),
@ -279,14 +270,14 @@ INSERT INTO vn.itemShelving (itemFk, shelvingFk, visible, created, `grouping`, p
INSERT INTO vn.operator (workerFk, numberOfWagons, trainFk, itemPackingTypeFk, warehouseFk)
VALUES
(9, 1, 1, 'V', 1);
*/
-- XXX: web
/* #5483
INSERT INTO `hedera`.`config` (`cookieLife`, `defaultForm`)
VALUES (15,'cms/home');
INSERT INTO `hedera`.`imageConfig` (`maxSize`, `url`)
VALUES (20, '//verdnatura.es/vn-image-data');
VALUES (20, '//cdn.verdnatura.es/image');
INSERT INTO `hedera`.`orderConfig` (`employeeFk`, `guestMethod`, `guestAgencyFk`, `defaultCompanyFk`)
VALUES (1, 'PICKUP', 1, 442);
@ -300,7 +291,7 @@ UPDATE `vn`.`agencyMode` SET `description` = `name`;
INSERT INTO `hedera`.`tpvConfig` (currency, terminal, transactionType, maxAmount, employeeFk, `url`, testMode, testUrl, testKey, merchantUrl)
VALUES (978, 1, 0, 2000, 9, 'https://sis.redsys.es/sis/realizarPago', 0, 'https://sis-t.redsys.es:25443/sis/realizarPago', 'sq7HjrUOBfKmC576ILgskD5srU870gJ7', NULL);
*/
INSERT INTO hedera.tpvMerchantEnable (merchantFk, companyFk)
VALUES (1, 442);

View File

@ -19,7 +19,7 @@ FROM (
(
(
`vn`.`ticket` `t`
JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticketFk` = `t`.`id`)
JOIN `vn`.`ticketStateToday` `tst` ON(`tst`.`ticket` = `t`.`id`)
)
JOIN `vn`.`state` `s` ON(`s`.`id` = `tst`.`state`)
)

View File

@ -3,8 +3,11 @@ require('core-js/stable');
require('regenerator-runtime/runtime');
require('vn-loopback/server/boot/date')();
const path = require('path');
const Myt = require('@verdnatura/myt/myt');
const Run = require('@verdnatura/myt/myt-run');
const axios = require('axios');
const Docker = require('../../db/docker.js');
const e2eConfig = require('./config.js');
const log = require('fancy-log');
@ -18,9 +21,9 @@ async function test() {
if (process.argv[2] === 'show')
process.env.E2E_SHOW = true;
const container = new Docker('salix-db');
await container.run();
const myt = new Myt();
await myt.init({workspace: path.join(__dirname, '../..')});
await myt.run(Run);
const Jasmine = require('jasmine');
const jasmine = new Jasmine();
@ -67,6 +70,8 @@ async function test() {
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
await jasmine.execute();
await myt.deinit();
}
async function backendStatus() {

View File

@ -3,9 +3,9 @@ const gulp = require('gulp');
const PluginError = require('plugin-error');
const argv = require('minimist')(process.argv.slice(2));
const log = require('fancy-log');
const Myt = require('../myt/myt');
const Run = require('../myt/myt-run');
const Start = require('../myt/myt-start');
const Myt = require('@verdnatura/myt/myt');
const Run = require('@verdnatura/myt/myt-run');
const Start = require('@verdnatura/myt/myt-start');
// Configuration

View File

@ -3,6 +3,7 @@ versionSchema: util
replace: true
sumViews: false
mockDate: '2001-01-01 12:00:00'
subdir: db
schemas:
- account
- bi

14
package-lock.json generated
View File

@ -54,7 +54,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.7.7",
"@verdnatura/myt": "^1.5.29",
"@verdnatura/myt": "^1.5.31",
"angular-mocks": "^1.7.9",
"babel-jest": "^26.0.1",
"babel-loader": "^8.2.4",
@ -3375,9 +3375,9 @@
}
},
"node_modules/@verdnatura/myt": {
"version": "1.5.29",
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.5.29.tgz",
"integrity": "sha512-d8PiGjjEQpEu4MyddRXGgay9gLOsD8V2SBxLws748g1WpECETJUZF8I8YKf/jH4Y91f1bFmW9kJn/PR+gA44ww==",
"version": "1.5.31",
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.5.31.tgz",
"integrity": "sha512-1mh5lY+gYRnvZsJUmc4t5kTyoo4uSvKJBI6KE1H+VEOnF9uuxSlie6srM04KexjzXIlrWa3xnZIYDrXP2D+fAQ==",
"dev": true,
"dependencies": {
"@sqltools/formatter": "^1.2.5",
@ -30604,9 +30604,9 @@
}
},
"@verdnatura/myt": {
"version": "1.5.29",
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.5.29.tgz",
"integrity": "sha512-d8PiGjjEQpEu4MyddRXGgay9gLOsD8V2SBxLws748g1WpECETJUZF8I8YKf/jH4Y91f1bFmW9kJn/PR+gA44ww==",
"version": "1.5.31",
"resolved": "https://registry.npmjs.org/@verdnatura/myt/-/myt-1.5.31.tgz",
"integrity": "sha512-1mh5lY+gYRnvZsJUmc4t5kTyoo4uSvKJBI6KE1H+VEOnF9uuxSlie6srM04KexjzXIlrWa3xnZIYDrXP2D+fAQ==",
"dev": true,
"requires": {
"@sqltools/formatter": "^1.2.5",

View File

@ -57,7 +57,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.7.4",
"@babel/preset-env": "^7.11.0",
"@babel/register": "^7.7.7",
"@verdnatura/myt": "^1.5.29",
"@verdnatura/myt": "^1.5.31",
"angular-mocks": "^1.7.9",
"babel-jest": "^26.0.1",
"babel-loader": "^8.2.4",