Skip to content

library upgrade#38

Open
saffiullah200 wants to merge 149 commits intomasterfrom
stage
Open

library upgrade#38
saffiullah200 wants to merge 149 commits intomasterfrom
stage

Conversation

@saffiullah200
Copy link
Copy Markdown
Collaborator

No description provided.

saffiullah200 and others added 30 commits August 5, 2024 20:55
filter and location issue resolved
maphathon flow updated
add mapathon issue fix
mapathin date validation fixed
update user profile resolvedd
forgot password link updated
resolve forgot password issues and activate user flow
replace remove function with delete one
resolve activation account issue
new fields added in user model lastLocation lastActivityTime and device
saffiullah200 and others added 30 commits January 26, 2026 11:56
- status=active: returns events where startDate <= today AND endDate >= today
- status=inactive: returns events where endDate < today (past events)
- status=all or no status: returns all events (no date filter)
- Added isOpen field to response for frontend to check manual status
- Allow compound names like 'Van Dyke', 'De La Cruz', 'Mary Ann'
- Fixes signup failure for users with multi-word names
- Activation ticket stores 'dateOfBirth' as string
- User model expects 'birthday' as Date
- Convert string to Date object when creating user
- Fixes date of birth not being saved during signup
- Add normalizeDateToNoonUTC helper function to helpers/index.js
- Apply normalization in activate-account.js (signup)
- Apply normalization in edit-user.js (profile update)
- Apply normalization in reactivate-account.js (account reactivation)
- Ensures birthday is always stored at noon UTC to prevent off-by-one day errors
- Fixes dateOfBirth -> birthday field mapping in activate-account.js
…iles

req.user is a plain object from toObject() in auth middleware, so .save()
and .comparePassword() are not available. This caused TypeError 500 errors
on create/join/leave events, create/leave teams, change password, and
petition approval.

- create-event.js: findByIdAndUpdate + fix endDate typo + add startDate
- join-event.js: findByIdAndUpdate $push events
- leave-event.js: findByIdAndUpdate $pull events
- create-team.js: findByIdAndUpdate $push teams
- leave-team.js: findByIdAndUpdate $pull teams
- change-password.js: fetch Mongoose doc for comparePassword + save
- edit-petition.js: findByIdAndUpdate for events and teams (2 occurrences)
- active: startDate <= today AND endDate >= today (currently running)
- upcoming: startDate > today (future mapathons)
- inactive: endDate < today (past mapathons)
- Added status validation in validateListEvents
…eriods

- GET /users/leaderboard supports period=allTime|month and limit (clamped 1-100)
- allTime: sorts by User.reviewsAmount, tie-break by createdAt
- month: aggregates Reviews since start of UTC month, joins users, filters archived
- 60s in-memory cache keyed by (period, limit) and Cache-Control: public, max-age=60
- Dense ranking (1-based, no gaps), ties share rank
Adds isSystemAccount boolean to the User schema (default false) and filters
it out of both allTime and month leaderboard queries. Brand/admin accounts
flagged with isSystemAccount: true will no longer appear, so the leaderboard
reflects real contributors only.
Frontend sends 'no' (lowercase) for the disability question, but the User
schema enum only allowed 'No' (capital N). This silently broke account
activation for any user selecting "No" — User.create threw a ValidationError
and the activation endpoint returned 500. Add 'no' alongside the existing 'No'
so both work with no data migration.
GET /events/:eventId/leaderboard?limit=N (max 5) — top contributors for one
mapathon, ranked by review count, ties broken by user.createdAt.

Aggregates Reviews scoped to the event, joins users, excludes archived /
blocked / admin / system accounts and banned reviews. Single $facet query
returns both the page slice and the total. 60s in-memory cache keyed by
(eventId, limit) plus Cache-Control: public, max-age=60.

Backs the Mapathon Leaderboard UI in axsmap/app#186.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants