diff --git a/back/methods/postcode/specs/filter.spec.js b/back/methods/postcode/specs/filter.spec.js index abf450a19..7ebce495a 100644 --- a/back/methods/postcode/specs/filter.spec.js +++ b/back/methods/postcode/specs/filter.spec.js @@ -29,7 +29,7 @@ describe('Postcode filter()', () => { } }, options); - expect(results.length).toEqual(4); + expect(results.length).toEqual(5); await tx.rollback(); } catch (e) { await tx.rollback(); @@ -63,7 +63,7 @@ describe('Postcode filter()', () => { search: 'one', }}, options); - expect(results.length).toEqual(4); + expect(results.length).toEqual(5); await tx.rollback(); } catch (e) { await tx.rollback(); diff --git a/back/methods/vn-user/update-user.js b/back/methods/vn-user/update-user.js index 202b01c65..2bb390cf9 100644 --- a/back/methods/vn-user/update-user.js +++ b/back/methods/vn-user/update-user.js @@ -26,7 +26,7 @@ module.exports = Self => { description: 'The user lang' }, { arg: 'twoFactor', - type: 'string', + type: 'any', description: 'The user twoFactor' } ], diff --git a/back/models/vn-user.json b/back/models/vn-user.json index 415aa6810..8c49c8db9 100644 --- a/back/models/vn-user.json +++ b/back/models/vn-user.json @@ -165,7 +165,8 @@ "hasGrant", "realm", "email", - "emailVerified" + "emailVerified", + "twoFactor" ] } } diff --git a/db/dump/fixtures.before.sql b/db/dump/fixtures.before.sql index 91de1dc05..c0d151b2c 100644 --- a/db/dump/fixtures.before.sql +++ b/db/dump/fixtures.before.sql @@ -361,11 +361,12 @@ INSERT INTO `vn`.`town`(`id`, `name`, `provinceFk`) INSERT INTO `vn`.`postCode`(`code`, `townFk`, `geoFk`) VALUES - ('46000', 1, 6), - ('46460', 2, 6), - ('46680', 3, 6), - ('46600', 4, 7), - ('EC170150', 5, 8); + ('46000', 1, 6), + ('46460', 2, 6), + ('46680', 3, 6), + ('46600', 4, 7), + ('46600',1, 6), + ('EC170150', 5, 8); INSERT INTO `vn`.`clientType`(`code`, `type`) VALUES @@ -3936,7 +3937,7 @@ INSERT INTO vn.medicalReview (id, workerFk, centerFk, `date`, `time`, isFit, amount, invoice, remark) VALUES(3, 9, 2, '2000-01-01', '8:00', 1, 150.0, NULL, NULL); -INSERT INTO vn.stockBought (workerFk, bought, reserve, dated) +INSERT INTO vn.stockBought (workerFk, bought, reserve, dated) VALUES(35, 1.00, 1.00, '2001-01-01'); INSERT INTO vn.auctionConfig (id,conversionCoefficient,warehouseFk) diff --git a/db/routines/vn/functions/MIDNIGHT.sql b/db/routines/vn/functions/MIDNIGHT.sql deleted file mode 100644 index d40734fcf..000000000 --- a/db/routines/vn/functions/MIDNIGHT.sql +++ /dev/null @@ -1,8 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`MIDNIGHT`(vDate DATE) - RETURNS datetime - DETERMINISTIC -BEGIN - RETURN TIMESTAMP(vDate,'23:59:59'); -END$$ -DELIMITER ; diff --git a/db/routines/vn/functions/routeProposal_.sql b/db/routines/vn/functions/routeProposal_.sql deleted file mode 100644 index a307d8fc0..000000000 --- a/db/routines/vn/functions/routeProposal_.sql +++ /dev/null @@ -1,30 +0,0 @@ -DELIMITER $$ -CREATE OR REPLACE DEFINER=`vn`@`localhost` FUNCTION `vn`.`routeProposal_`(vTicketFk INT) - RETURNS int(11) - NOT DETERMINISTIC - READS SQL DATA -BEGIN - - DECLARE vRouteFk INT; - DECLARE vAddressFk INT; - DECLARE vShipped DATETIME; - - SELECT addressFk, date(shipped) INTO vAddressFk, vShipped - FROM vn.ticket - WHERE id = vTicketFk; - - SELECT routeFk INTO vRouteFk - FROM - (SELECT t.routeFk, sum(af.friendship) friendshipSum - FROM vn.ticket t - JOIN cache.addressFriendship af ON af.addressFk2 = t.addressFk AND af.addressFk1 = vAddressFk - WHERE t.shipped BETWEEN vShipped and MIDNIGHT(vShipped) - AND t.routeFk - GROUP BY routeFk - ORDER BY friendshipSum DESC - ) sub - LIMIT 1; - - RETURN vRouteFk; -END$$ -DELIMITER ; diff --git a/db/routines/vn/procedures/itemShelvingProblem.sql b/db/routines/vn/procedures/itemShelvingProblem.sql index bb4725434..06c7a376c 100644 --- a/db/routines/vn/procedures/itemShelvingProblem.sql +++ b/db/routines/vn/procedures/itemShelvingProblem.sql @@ -38,7 +38,7 @@ BEGIN AND IFNULL(sub3.transit,0) < s.quantity AND s.isPicked = FALSE AND s.reserved = FALSE - AND t.shipped BETWEEN util.VN_CURDATE() AND MIDNIGHT(util.VN_CURDATE()) + AND t.shipped BETWEEN util.VN_CURDATE() AND util.midnight() AND tst.isPreviousPreparable = TRUE AND t.warehouseFk = vWarehouseFk AND iss.sectorFk = vSectorFk diff --git a/db/routines/vn/views/ticketStateToday.sql b/db/routines/vn/views/ticketStateToday.sql index 0c9e01188..8c11fcc87 100644 --- a/db/routines/vn/views/ticketStateToday.sql +++ b/db/routines/vn/views/ticketStateToday.sql @@ -13,4 +13,4 @@ FROM ( `vn`.`ticketState` `ts` JOIN `vn`.`ticket` `t` ON(`t`.`id` = `ts`.`ticketFk`) ) -WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `MIDNIGHT`(`util`.`VN_CURDATE`()) +WHERE `t`.`shipped` BETWEEN `util`.`VN_CURDATE`() AND `util`.`midnight`() diff --git a/modules/account/back/model-config.json b/modules/account/back/model-config.json index 0cd43d0ce..cfec1fbe4 100644 --- a/modules/account/back/model-config.json +++ b/modules/account/back/model-config.json @@ -1,4 +1,7 @@ { + "Account": { + "dataSource": "vn" + }, "AccountConfig": { "dataSource": "vn" }, @@ -47,9 +50,6 @@ "SipConfig": { "dataSource": "vn" }, - "Account": { - "dataSource": "vn" - }, "UserLog": { "dataSource": "vn" }, diff --git a/modules/client/back/models/address.js b/modules/client/back/models/address.js index 4a93b5d5c..7011008a4 100644 --- a/modules/client/back/models/address.js +++ b/modules/client/back/models/address.js @@ -43,8 +43,14 @@ module.exports = Self => { include: [{ relation: 'province', scope: { - fields: ['id', 'name'] - } + fields: ['id', 'name', 'countryFk'], + include: [ + { + relation: 'country', + scope: {fields: ['id', 'name']}, + }, + ], + }, }, { relation: 'agencyMode', scope: { diff --git a/myt.config.yml b/myt.config.yml index 717175a08..663b1aec2 100755 --- a/myt.config.yml +++ b/myt.config.yml @@ -394,4 +394,4 @@ localFixtures: - zoneExclusionGeo - zoneGeo - zoneIncluded - - zoneWarehouse \ No newline at end of file + - zoneWarehouse