feat: update user data model to include OOO periods and idle window t…#79
feat: update user data model to include OOO periods and idle window t…#79
Conversation
WalkthroughThe Firestore user status document schema in the README has been expanded to include four new fields: Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@users-status/README.md`:
- Around line 25-28: Add a new "Fields" section in users-status/README.md near
the schema that documents each new field: idleWindowStartedAt, lastOooFrom,
lastOooUntil, and oooPeriods; for each field include Type (explicitly state
Number is a Unix timestamp in milliseconds | null), a one-line Description
(e.g., idleWindowStartedAt = when an idle window was initiated;
lastOooFrom/lastOooUntil = start/end of most recent OOO period; oooPeriods =
array history of {from, until}), Population rules (when and how the app sets
each field — e.g., auto-calculated on status change, updated/appended when OOO
is approved), and a brief Migration strategy describing how existing documents
will be backfilled (e.g., default nulls, compute lastOoo* from historical OOO
events, append to oooPeriods) and where these updates run (migration script or
service).
- Around line 25-28: The timestamp fields idleWindowStartedAt, lastOooFrom,
lastOooUntil and the oooPeriods entries are declared as Number/Number|null and
an object with Number fields; change them to use the existing TimeStamp type for
consistency with the schema (i.e., idleWindowStartedAt: TimeStamp | null,
lastOooFrom: TimeStamp | null, lastOooUntil: TimeStamp | null, and oooPeriods:
Array<{ from: TimeStamp, until: TimeStamp }>), updating any related
docs/comments or examples that reference these fields (idleWindowStartedAt,
lastOooFrom, lastOooUntil, oooPeriods) to reflect the TimeStamp type.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3a1a8b99-0db2-4dbb-b47e-887b9ce1585d
📒 Files selected for processing (1)
users-status/README.md
Date: 10-03-2026
Developer Name: @vinit717
Issue Ticket Number
Description
Added new fields
idleWindowStartedAt(number | null)When the current idle window started (e.g. task completed). Set on
ACTIVE -> IDLE; reset tonullon-> ACTIVE. Single source of truth for “idle from” so the window survives OOO.lastOooFrom(number | null)Start of the most recent completed OOO interval. Kept for backward compatibility and for “last OOO” display/APIs.
lastOooUntil(number | null)End of the most recent completed OOO interval. Same as above.
oooPeriods(array of{ from: number, until: number })History of completed OOO intervals in the current idle window. Used to subtract all OOO days when computing “idle 7d+”. Supports multiple OOO periods; overlaps are merged so we never double-subtract. Optional: you could derive this from an event log, but storing it on the doc keeps reads simple and avoids N+1 or extra collections.
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes