diff --git a/back/methods/collection/getCollection.js b/back/methods/collection/getCollection.js index caf9cc5210..e02d2c5c77 100644 --- a/back/methods/collection/getCollection.js +++ b/back/methods/collection/getCollection.js @@ -3,7 +3,7 @@ module.exports = Self => { description: 'Get pending collections from a worker', accessType: 'READ', returns: { - type: 'Object', + type: 'object', root: true }, http: { diff --git a/back/methods/collection/spec/getCollection.spec.js b/back/methods/collection/spec/getCollection.spec.js index bfd3e36031..5ea042f9d7 100644 --- a/back/methods/collection/spec/getCollection.spec.js +++ b/back/methods/collection/spec/getCollection.spec.js @@ -1,9 +1,9 @@ -const app = require('vn-loopback/server/server'); +const models = require('vn-loopback/server/server').models; -describe('getCollection()', () => { - it('return list of collection', async() => { +describe('ticket getCollection()', () => { + it('should return a list of collections', async() => { let ctx = {req: {accessToken: {userId: 1106}}}; - let response = await app.models.Collection.getCollection(ctx); + let response = await models.Collection.getCollection(ctx); expect(response.length).toBeGreaterThan(0); expect(response[0].collectionFk).toEqual(1); diff --git a/db/dump/fixtures.sql b/db/dump/fixtures.sql index 3da674cb14..8ce5061c54 100644 --- a/db/dump/fixtures.sql +++ b/db/dump/fixtures.sql @@ -1067,10 +1067,10 @@ INSERT INTO `vn`.`itemPlacement`(`id`, `itemFk`, `warehouseFk`, `code`) (4, 2, 1, 'A44'); -INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`) +INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`, `created`) VALUES - (1, 1106, 5), - (2, 1106, 14); + (1, 1106, 5, DATE_ADD(CURDATE(),INTERVAL +1 DAY)), + (2, 1106, 14, CURDATE()); INSERT INTO `vn`.`ticketCollection`(`id`, `ticketFk`, `collectionFk`) VALUES @@ -2224,6 +2224,11 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11'); +INSERT INTO `vn`.`temperature`(`code`, `name`, `description`) + VALUES + ('WARM', 'Warm', 'Warm'), + ('COOL', 'Cool', 'Cool'); + INSERT INTO `vn`.`thermograph`(`id`, `model`) VALUES ('TMM190901395', 'TEMPMATE'), @@ -2231,7 +2236,8 @@ INSERT INTO `vn`.`thermograph`(`id`, `model`) ('TZ1905012010', 'DISPOSABLE'), ('138350-0', 'DISPOSABLE'); -INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperature`, `result`, `dmsFk`) + +INSERT INTO `vn`.`travelThermograph`(`thermographFk`, `created`, `warehouseFk`, `travelFk`, `temperatureFk`, `result`, `dmsFk`) VALUES ('TMM190901395', CURDATE(), 1, 1, 'WARM', 'Ok', NULL), ('TL.BBA85422', DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 2, 2, 'COOL', 'Ok', NULL),