fix(models): restore check_in/check_out on AvailabilityQuery
v0.4.0's merge of public_booking_dict landed inside AvailabilityQuery and left the two date fields orphaned after the helper's return, so POST /api/v1/availability raised AttributeError on q.check_in (500) on every install of that version. The RPC door reads the raw body and was unaffected, which is why nothing noticed. Put the helper next to public_room_dict and add a regression test that constructs the query model and drives the endpoint through the services layer. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
b41cfac691
commit
64607a00bc
2 changed files with 60 additions and 4 deletions
|
|
@ -206,8 +206,6 @@ def public_room_dict(room: Room) -> dict:
|
|||
return d
|
||||
|
||||
|
||||
class AvailabilityQuery(BaseModel):
|
||||
room_id: str
|
||||
def public_booking_dict(booking: "Booking") -> dict:
|
||||
"""A Booking as public JSON for the guest who holds its id — lifecycle +
|
||||
money + dates only. Strips the guest's own identity/contact (so the id
|
||||
|
|
@ -227,8 +225,10 @@ def public_booking_dict(booking: "Booking") -> dict:
|
|||
return d
|
||||
|
||||
|
||||
check_in: str # YYYY-MM-DD inclusive
|
||||
check_out: str # YYYY-MM-DD exclusive
|
||||
class AvailabilityQuery(BaseModel):
|
||||
room_id: str
|
||||
check_in: str # YYYY-MM-DD inclusive
|
||||
check_out: str # YYYY-MM-DD exclusive
|
||||
|
||||
|
||||
class AvailabilityResult(BaseModel):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue