Skip to content

Commit 2de8005

Browse files
committed
add specific type while building query
1 parent f687358 commit 2de8005

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

utils/monitor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const { RESOURCE_NOT_FOUND } = RESPONSE_MESSAGES;
1515
const buildTrackedProgressQueryByType = (queryParams) => {
1616
const { userId, taskId } = queryParams;
1717
if (userId) {
18-
return trackedProgressesCollection.where("userId", "==", userId);
18+
return trackedProgressesCollection.where("type", "==", "user").where("userId", "==", userId);
1919
} else {
20-
return trackedProgressesCollection.where("taskId", "==", taskId);
20+
return trackedProgressesCollection.where("type", "==", "task").where("taskId", "==", taskId);
2121
}
2222
};
2323

@@ -49,9 +49,9 @@ const buildQueryForFetchingDocsOfType = (queryParams) => {
4949
const buildQueryToFetchTrackedDoc = (queryParams) => {
5050
const { userId, taskId } = queryParams;
5151
if (userId) {
52-
return trackedProgressesCollection.where("userId", "==", userId);
52+
return trackedProgressesCollection.where("type", "==", "user").where("userId", "==", userId);
5353
} else {
54-
return trackedProgressesCollection.where("taskId", "==", taskId);
54+
return trackedProgressesCollection.where("type", "==", "task").where("taskId", "==", taskId);
5555
}
5656
};
5757

0 commit comments

Comments
 (0)