fix(calendar): reject inverted appointment time range on update (PMS-343) #253
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-343-appointment-time-range"
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?
What
Reject inverted (end before start) appointment time ranges on the update path.
create_appointmentalready enforcedend_time > start_timeat the service layer, butupdate_appointmentdid not, so a partial PUT (e.g. onlyend_time) could invert an appointment's range against its stored values.Changes
appointment_range_ok(start, end)helper incalendar/models.rs, with unit tests (end-after-start ok, end-before-start rejected, zero-length rejected).create_appointmentnow calls the helper (behavior unchanged: rejectsend <= start).update_appointmentloads the current start/end, computes the effective range (request value when provided, else the stored value), and rejects an inverted range before writing.Testing
cargo test --lib(dev container): 3 new range tests pass; full lib compiles.cargo clippy --all-targets -- -D warnings: clean.cargo fmt --all --check: clean.Note on the issue
PMS-343 described the create path as unguarded; on inspection, create was already guarded at the service layer, so the real gap (and the substance of this fix) was the update path. The shared helper keeps both paths consistent. (Issue record corrected with a comment.)