Skip to content

fix(rooms): allow moving a room to another room type, same-property checked - #319

Merged
telivity-otaip merged 3 commits into
TelivityAI:mainfrom
modernitconsultants:fix/room-type-move
Aug 13, 2026
Merged

fix(rooms): allow moving a room to another room type, same-property checked#319
telivity-otaip merged 3 commits into
TelivityAI:mainfrom
modernitconsultants:fix/room-type-move

Conversation

@modernitconsultants

Copy link
Copy Markdown
Contributor

UpdateRoomDto omits roomTypeId entirely, so PATCH /rooms/:id cannot re-categorise a room — there's no API path at all for a legitimate admin operation (splitting a shared type into per-room types, re-tiering inventory). We hit it doing exactly that restructure.

Re-added as an optional update field with the FK-ownership check the codebase already applies to inbound-reservation mappings: the target type must belong to the same property, or 404 — an update can never re-point a room at another tenant's type. That check is presumably why the field was omitted; this keeps the protection while restoring the operation.

…hecked

UpdateRoomDto omits roomTypeId entirely, so PATCH /rooms/:id cannot
re-categorise a room — there is no API path at all for a legitimate admin
operation (splitting a shared type into per-room types, re-tiering
inventory). Re-added as an optional update field WITH the FK-ownership
check the codebase already applies to inbound-reservation mappings: the
target type must belong to the same property, or 404 — an update can never
re-point a room at another tenant's type.
telivity-otaip and others added 2 commits August 13, 2026 00:02
Follow-up on the roomTypeId PATCH unlock: reject moves while the room is
occupied or linked to an assigned/in-house reservation (avoids desyncing
reservation.roomTypeId), and cover FK ownership + guards in unit tests.

Co-authored-by: Charles Pizzato <311327716+modernitconsultants@users.noreply.github.com>
@telivity-otaip

Copy link
Copy Markdown
Collaborator

Pushed a small follow-up on your branch (maintainer edit) — credit stays with you via Co-authored-by.

On top of the roomTypeId unlock + same-property FK check:

  • Block type moves while the room is occupied, or linked to an assigned / checked_in / stayover / due_out reservation (avoids desyncing reservation.roomTypeId)
  • Unit tests for cross-tenant reject, occupied reject, linked-stay reject, happy-path vacant move, and unchanged-roomTypeId skip

Your original change is unchanged in intent; this just hardens the edge cases before merge. Thanks again for the fix.

@telivity-otaip
telivity-otaip merged commit c1f049a into TelivityAI:main Aug 13, 2026
5 checks passed
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.

3 participants