Skip to content

feat(timesheet): v14.5.0 Time & Timesheets module (TIME-01..07)#265

Merged
parth0025 merged 10 commits into
stagingfrom
feat/v14.5.0-time-timesheets
Jun 20, 2026
Merged

feat(timesheet): v14.5.0 Time & Timesheets module (TIME-01..07)#265
parth0025 merged 10 commits into
stagingfrom
feat/v14.5.0-time-timesheets

Conversation

@parth0025

Copy link
Copy Markdown
Collaborator

v14.5.0 β€” Time & Timesheets module (TIME-01 β†’ TIME-07)

First module of v14.5.0, built end-to-end. One PR for the whole module.

Tasks

  • TIME-01 Timesheet approval workflow β€” new timesheet_approval collection; submit β†’ approve/reject/reopen; owner/admin gate enforced server-side; TimesheetApproval.vue in the User Timesheet toolbar.
  • TIME-02 Billable vs non-billable flag β€” billable on each entry (default true); toggle in Add/Edit Time Log; getBillableSummary + a billable/non-billable readout.
  • TIME-03 Period locking β€” entries in an approved period are read-only (server-side, tamper-proof).
  • TIME-04 Payroll CSV export β€” /export-csv (user names from global DB, project names from company DB) + an Export CSV button.
  • TIME-05 Idle-time detection β€” desktop tracker auto-pauses after a configurable idle threshold (AV-safe). Ships when the tracker installers are rebuilt.
  • TIME-06 Time-entry reminders β€” daily cron + /send-reminders email nudge to members who haven't logged.
  • TIME-07 Billing rates + invoicing β€” billing_rates collection + invoice generation from billable time; rate input + Invoice button.

Tests: 296 unit tests across 26 suites (+71 new). Per-feature manual test cases in .claude/test-cases/.

Notes: all server-side time mutations now respect period locks; fixed a TIME-01 totals bug (LogStartTime is seconds). TIME-05 lives in time-tracker-app/ (separate build). TIME-07 seeds the v14.6.0 Profitability theme.

πŸ€– Generated with Claude Code

parth0025 and others added 10 commits June 20, 2026 12:56
Period-based submit -> review -> approve/reject/reopen workflow layered on
top of the existing raw time logs (which are never mutated).

- New per-company `timesheet_approval` collection (one doc per user/period),
  registered across schemaType, collections, schema, createSchema, mongoQueries.
- Modules/TimesheetApproval: pure approvalRules (state machine + validation),
  controller (submit/status/mine/pending/review), routes, init.
- Review is enforced server-side to owner/admin via permissionGuard.getRoleType;
  members may submit only their own period; an approved period is locked.
- Totals (minutes + entry count) are snapshotted at submit for reviewer context.
- 30 unit tests for the approval rules.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- TimesheetApproval.vue in the User Timesheet toolbar: employees see their
  period status and a submit/resubmit control; owners/admins get a pending
  queue with approve / reject (with reason). Calls the TIME-01 API; raw
  time entries are untouched.
- env.TIMESHEET_APPROVAL endpoint constant + en.js i18n strings.
- .claude/test-cases/TimesheetApproval.md (16 UI/integration cases).

Full suite green: 255 tests across 22 suites.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
LogStartTime is stored in Unix seconds (manualLogtime getTimeStamp), but
computePeriodTotals queried it with millisecond bounds, so a submitted
period's totalMinutes/entryCount snapshot was always 0. Convert the day
bounds to seconds before the range query.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- `billable` boolean on the timesheet entry schema (defaults true; only an
  explicit false is non-billable, so pre-existing entries count as billable).
- manualLogTime persists `billable` on create + edit.
- Modules/TimeSheet: pure billableRules (normalizeBillable + summarize) and a
  getBillableSummary endpoint (/api/v1/timesheet/billable-summary) returning
  billable vs non-billable minute/entry totals for a user set + period.
- 7 unit tests for the billable rules (full suite 262 green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Billable toggle in the Add/Edit Time Log form (defaults on; sends `billable`).
- BillableSummary.vue in the User Timesheet toolbar β€” billable vs non-billable
  hours for the selected period + visible users.
- en.js i18n; .claude/test-cases/BillableFlag.md (10 UI/API cases).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Once a period is approved (TIME-01), its time entries become read-only.

- coversDate rule + isPeriodLocked guard (Modules/TimesheetApproval).
- manualLogTime (edit) and deleteManualLogtime block any change to an entry
  whose day falls inside an approved period β€” enforced server-side (tamper-proof).
- Add/Edit Time Log surfaces the server lock message.
- 6 coversDate unit tests (full suite 268 green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Pure timesheetCsv builder (RFC-4180 escaping) + /api/v1/timesheet/export-csv
  endpoint resolving user names (global DB) and project names (company DB).
- Columns: User, Project, Date, Description, Billable, Hours (decimal).
- Export CSV button in the User Timesheet toolbar (period + user/project scoped).
- 9 unit tests (full suite 277 green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The desktop tracker auto-pauses when there's no activity for a configurable
threshold (default 5 min; 0 disables).

- Implemented in the Electron main process using the existing AV-safe signal
  (powerMonitor.getSystemIdleTime + cursor) β€” no global input hook.
- On idle >= threshold while tracking: sends idle:detected and reuses the
  proven stop-tracker pathway to pause, plus a system notification. Fires once
  per idle spell; resets on activity and on (re)start.
- Threshold configurable + persisted (idle-config.json) via
  idle:set-threshold / idle:get-threshold.

Ships when the tracker installers are rebuilt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Pure reminderRules (who needs reminding + the message) + a per-company
  service that emails members who haven't logged time today via
  service.SendEmail (Resend/SMTP, graceful when mail is unconfigured).
- Prod cron daily at 17:00 (runRemindersForAllCompanies); POST
  /api/v1/timesheet/send-reminders runs the same path on demand (testing).
- 7 unit tests (full suite 284 green).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- New per-company billing_rates collection (scope: user/project/default).
- Pure billingRules (resolveRate precedence user>project>default + buildInvoice)
  + endpoints POST/GET /rates and POST /generate-invoice (billable time x rate).
- TimesheetInvoice.vue: a rate input + Invoice button in the timesheet toolbar
  that generates and downloads an invoice CSV.
- 12 unit tests (full suite 296 green).

Seeds the v14.6.0 Profitability theme (FIN-01).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@parth0025 parth0025 merged commit ef76a11 into staging Jun 20, 2026
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b3fda4ba-5541-4c85-8507-2f3e2231a513

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • πŸ” Trigger review
✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/v14.5.0-time-timesheets

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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