feat(Searchbar): You can now filter by a ticket collection #722
|
@ -6,6 +6,6 @@ describe('newCollection()', () => {
|
||||||
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);
|
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);
|
||||||
|
|
||||||
expect(response.length).toBeGreaterThan(0);
|
expect(response.length).toBeGreaterThan(0);
|
||||||
expect(response[0].ticketFk).toEqual(1);
|
expect(response[0].ticketFk).toEqual(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1064,6 +1064,11 @@ INSERT INTO `vn`.`collection`(`id`, `workerFk`, `stateFk`)
|
||||||
(1, 1106, 5),
|
(1, 1106, 5),
|
||||||
(2, 1106, 14);
|
(2, 1106, 14);
|
||||||
|
|
||||||
|
INSERT INTO `vn`.`ticketCollection`(`id`, `ticketFk`, `collectionFk`)
|
||||||
|
VALUES
|
||||||
|
(2, 2, 1),
|
||||||
|
(3, 3, 2);
|
||||||
|
|
||||||
INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
INSERT INTO `vn`.`parking` (`column`, `row`, `sectorFk`, `code`, `pickingOrder`)
|
||||||
VALUES
|
VALUES
|
||||||
('100', '01', 1, '100-01', 1);
|
('100', '01', 1, '100-01', 1);
|
||||||
|
|
|
@ -202,4 +202,23 @@ describe('ticket filter()', () => {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return the tickets belonging to the collection id 1', async() => {
|
||||||
|
const tx = await models.Ticket.beginTransaction({});
|
||||||
|
|
||||||
|
try {
|
||||||
|
const options = {transaction: tx};
|
||||||
|
|
||||||
|
const ctx = {req: {accessToken: {userId: 18}}, args: {collectionFk: 1}};
|
||||||
|
const filter = {};
|
||||||
|
const result = await models.Ticket.filter(ctx, filter, options);
|
||||||
|
|
||||||
|
expect(result.length).toEqual(2);
|
||||||
|
|
||||||
|
await tx.rollback();
|
||||||
|
} catch (e) {
|
||||||
|
await tx.rollback();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue