feat(Searchbar): You can now filter by a ticket collection #722

Merged
carlosjr merged 3 commits from 3068-ticket_colletion into dev 2021-09-02 13:20:33 +00:00
3 changed files with 25 additions and 1 deletions
Showing only changes of commit 7a98613ef8 - Show all commits

View File

@ -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);
}); });
}); });

View File

@ -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);

View File

@ -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;
}
});
}); });