Track user last active time in database 🟢
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, mongodb, nodejs
- Domain
- api, authentication, backend
Research direction
Start with server/models/User.js and server/middleware/auth.js, then locate the GET /api/auth/me route. Check how the authenticated user is found and returned, and run the relevant existing tests. Done when the user’s last-active time is stored and updated on authenticated requests, and is included in the /api/auth/me response.
Written by the indexing model from the issue text.
Description
Track user last active time in database 🟢
File: server/models/User.js + server/middleware/auth.js
No record of when users were last active 💀
Can't show "active 2h ago" anywhere fr!!
Fix: add lastActive to User model:
lastActive: {
type: Date,
default: Date.now
}
// update on every authenticated request
// in middleware/auth.js after finding user:
await User.findByIdAndUpdate(
decoded.id,
{ lastActive: new Date() },
{ timestamps: false }
)
// expose in GET /api/auth/me route:
res.json({
...user.toObject(),
lastActive: user.lastActive
})
~8 lines across 2 files!
No frontend changes needed yet 🎯
Foundation for online presence feature!! 🔥
- Dominant language
- JavaScript
- Stars
- 39
- Forks
- 105
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from anoopcodehack/DevBoard
-
good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
anoopcodehack/DevBoard#589 ·
Maintainers usually reply within 2 days
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anoopcodehack/DevBoard#588 ·
Maintainers usually reply within 2 days
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100
anoopcodehack/DevBoard#586 ·
Maintainers usually reply within 2 days
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
anoopcodehack/DevBoard#584 ·
Maintainers usually reply within 2 days
-
good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
anoopcodehack/DevBoard#583 ·
Maintainers usually reply within 2 days
All issues in anoopcodehack/DevBoard
Similar issues
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)Possibly taken @SelaseKay claimed this today. OpenNeeds Attention type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
invertase/react-native-firebase#9364 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
tchiotludo/akhq#3307 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
DietrichGebert/ponytail#1063 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
zen-browser/desktop#15809 · 1 reaction ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 1/5 Under an hour Newbie friendliness 90/100