Skip to content

Sayali: add projectHistory tracking and getAllTimeprojectMembership endpoint#2225

Open
sayali-2308 wants to merge 1 commit into
developmentfrom
Sayali-Fix-AllTime-Members-Backend
Open

Sayali: add projectHistory tracking and getAllTimeprojectMembership endpoint#2225
sayali-2308 wants to merge 1 commit into
developmentfrom
Sayali-Fix-AllTime-Members-Backend

Conversation

@sayali-2308
Copy link
Copy Markdown
Contributor

image

Description

Fixes #1 (Priority Medium) - Fix the Projects Report incomplete Members list when the ALL-TIME button is selected.

Related PRs (if any):

This backend PR is related to frontend OneCommunityGlobal/HighestGoodNetworkApp#5225
To test this backend PR you need to checkout frontend branch: Sayali-Fix-AllTime-Members-ProjectReport

Main changes explained:

  • Added projectHistory field to userProfile model to track all projects a user has ever been assigned to, even after unassignment
  • Added getAllTimeprojectMembership endpoint (GET /api/project/:projectId/alltimeusers/) that queries users by projectHistory instead of projects
  • Updated putUserProfile in userProfileController.js to update projectHistory whenever a user's projects change
  • Added getProjectHistory and postClearProjectHistory utility functions
  • Added new routes in projectRouter.js and userProfileRouter.js
  • Fixed getprojectMembership to use mongoose.Types.ObjectId for proper ObjectId matching

How to test:

  1. Checkout branch Sayali-Fix-AllTime-Members-Backend
  2. Run npm install and npm run build then npm run start
  3. Also checkout frontend branch Sayali-Fix-AllTime-Members-ProjectReport
  4. Clear site data/cache, log as admin user
  5. Go to Reports → Reports → Projects → select any project
  6. Verify ACTIVE tab shows only currently assigned members
  7. Remove a user from the project
  8. Verify ACTIVE count drops but ALL-TIME count remains the same

Screenshots or videos of changes:

image image

Note:

This PR works together with frontend OneCommunityGlobal/HighestGoodNetworkApp#5225 Both must be merged together for the fix to work.

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant