We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent aecf57a commit 7403a59Copy full SHA for 7403a59
src/graphql/resolvers/Activity.js
@@ -22,9 +22,13 @@ export default {
22
if (!user) {
23
throw new Error('No auth');
24
}
25
- const procedure = await ProcedureModel.findOne({
26
- $or: [{ procedureId }, { _id: Types.ObjectId(procedureId) }],
27
- });
+ let searchQuery;
+ if (Types.ObjectId.isValid('procedureId')) {
+ searchQuery = { _id: Types.ObjectId(procedureId) };
28
+ } else {
29
+ searchQuery = { procedureId };
30
+ }
31
+ const procedure = await ProcedureModel.findOne(searchQuery);
32
if (!procedure) {
33
throw new Error('Procedure not found');
34
0 commit comments