Vamsidhar - fix: add all-logs endpoint and fix member lookup in aggregation pipeline #1994
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the Time Log Visibility issue on the Member Group Check-In page by adding a new endpoint to fetch all project time logs and fixing the member lookup in the aggregation pipeline. Previously, the frontend could not fetch all time logs for a project, and member information was not being correctly joined, resulting in "Unknown User" being displayed.
Fixes # (bug list priority: Medium) - Time Log Visibility Issue on Member Group Check-In Page
Related PRs (if any):
This backend PR is related to the frontend PR #4685.
To test this backend PR you need to checkout the frontend PR #4685.
Main changes explained:
src/routes/bmdashboard/bmTimeLoggerRouter.js:/timelogger/:projectId/logsto fetch all time logs for a project/logs) comes before the member-specific route (/:memberId/logs) to prevent route matching conflicts that caused 404 errorssrc/controllers/bmdashboard/bmTimeLoggerController.js:getProjectTimeLogsfunction to handle both all-logs and member-specific queriesmemberfield to ObjectId (handles both string and ObjectId types)'userprofiles'to'userProfiles'to match the actual MongoDB collection nameprojectIdandmemberIdin match stagestartTimeLogto ensure proper MongoDB queries when creating new time logsupdatedAtfield to the projection for proper sorting of completed logsHow to test:
Vamsidhar-fix/time-log-visibility-backendbranchnpm installto ensure dependencies are up to datenpm start00:00:00(not from old values)00:00:00)Screenshots or videos of changes:
N/A (Backend API changes)
