Skip to content

Commit

Permalink
Merge 60b0e7a into 013aa6a
Browse files Browse the repository at this point in the history
  • Loading branch information
tvpeter committed Sep 11, 2019
2 parents 013aa6a + 60b0e7a commit 489d647
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/controllers/Trip.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ class TripController {
try {
const userTrips = await Trip.findAll({
where: { userId: id },
attributes: {
exclude: ['startBranchId', 'userId']
},
include: [
{
model: Stop,
as: 'stop',
attributes: ['destinationBranchId', 'accomodationId'],
include: [{ model: Branch, as: 'branch', attributes: ['id', 'name', 'locationId'] },
attributes: ['id'],
include: [{ model: Branch, as: 'branch', attributes: ['id', 'name'] },
{ model: Accomodation, as: 'accomodation', attributes: ['id', 'name', 'capacity', 'status'] }]
},
{ model: User, as: 'user', attributes: ['firstName', 'lastName'] },
Expand Down
3 changes: 1 addition & 2 deletions test/trip.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ describe('Travel Request', () => {
chai.request(app).get(`${baseURL}/user`).send({ token }).end((err, res) => {
expect(res.status).to.eq(200);
expect(res.body.message).to.eq('User requests successfully retrieved');
expect(res.body.data[0].userId).to.eq(completeLoginWithCode.id);
expect(res.body.data[0].stop).to.be.an('Array');
expect(res.body.data).to.be.an('Array');
done();
});
});
Expand Down

0 comments on commit 489d647

Please sign in to comment.