Skip to content

Commit

Permalink
Add initiators to the 'associated' return
Browse files Browse the repository at this point in the history
The query resolver 'associated' should also return query initiators to
its return value. This commit adds this.
  • Loading branch information
Andrew Isherwood committed Sep 16, 2020
1 parent 7ac473d commit dba9f81
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resolvers/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ const queryResolvers = {
// Returns a promise resolving to an array of user IDs
associated: async (query_ids) => {
const participants = await queryResolvers.participants(query_ids);
const initiators = await queryResolvers.initiators(query_ids);
const allStaff = await userResolvers.allStaff();
let deDup = {};
participants.rows.forEach((pRow) => (deDup[pRow.creator_id] = 1));
initiators.rows.forEach((iRow) => (deDup[iRow.initiator] = 1));
allStaff.rows.forEach((sRow) => (deDup[sRow.id] = 1));
return Object.keys(deDup).map((key) => parseInt(key));
},
Expand Down

0 comments on commit dba9f81

Please sign in to comment.