feat(time-tracking): enforce per-tenant max-hours-per-day cap #298
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/PMS-396-max-hours-per-day-cap"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reject any time entry whose creation or update would push a user's total logged minutes for a calendar date over a configurable per-tenant cap, closing the server-side gap where the only 24h limit lived in the frontend and multiple entries (or a direct API call) could evade it.
validate_setting_valuethetime_tracking/max_hours_per_dayshape: an integer in 1..=24 (a day cannot exceed 24 real hours), rejecting out-of-range or non-integer values with HTTP 422.read_max_minutes_per_day, a free function returning the cap in minutes for a tenant and defaulting to 24*60 when unset, mirroringread_default_due_business_days.create_time_entryandupdate_time_entry: sum the user's existing minutes for the target date inside the same tenant-scoped transaction as the write (excluding the edited row on update, honoring a changed date), and return HTTP 400 naming the cap and the remaining minutes when the day would overflow.duration_minutesto 1..=1440 on both create and update DTOs so one entry can never alone exceed a day regardless of the per-day cap.#PMS-396
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
f88317274943cf626d88