Skip to content

Commit a99479d

Browse files
committed
add notified procedures to notifySettings Screen
1 parent 229edac commit a99479d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/graphql/resolvers/Procedure.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,20 @@ export default {
145145
},
146146
{ score: { $meta: 'textScore' } },
147147
).sort({ score: { $meta: 'textScore' } }),
148+
149+
notifiedProcedures: async (parent, args, { user, ProcedureModel }) => {
150+
if (!user) {
151+
throw new Error('no Auth');
152+
}
153+
const procedures = await ProcedureModel.find({
154+
_id: { $in: user.notificationSettings.procedures },
155+
});
156+
157+
return procedures.map(procedure => ({
158+
...procedure.toObject(),
159+
notify: true,
160+
}));
161+
},
148162
},
149163

150164
Procedure: {

src/graphql/schemas/Procedure.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type Procedure {
2626
type Query {
2727
procedure(id: ID!): Procedure
2828
procedures(type: ProcedureType!, pageSize: Int, offset: Int): [Procedure]
29+
notifiedProcedures: [Procedure]
2930
searchProcedures(term: String!): [Procedure]
3031
}
3132
`;

0 commit comments

Comments
 (0)