Skip to content

Commit

Permalink
booking.id
Browse files Browse the repository at this point in the history
  • Loading branch information
mamico committed Aug 2, 2024
1 parent 51f7412 commit fb144b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/design/plone/ioprenoto/restapi/services/booking/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ def reply(self):
)(fullobjects=True)

# BBB:
response["UID"] = response["booking_id"]
response["@type"] = booking.portal_type
response["id"] = booking.getId() # response["@id"].split("/")[-1]
response["UID"] = response["booking_id"]
response["gate"] = response["booking_gate"]
response["id"] = response["@id"].split("/")[-1]
response["booking_folder_uid"] = (
response["booking_folder"]["uid"] if "booking_folder" in response else None
)
Expand Down
4 changes: 2 additions & 2 deletions src/design/plone/ioprenoto/restapi/services/booking/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def reply(self):
)(fullobjects=True)

# BBB:
response["UID"] = response["booking_id"]
response["@type"] = booking.portal_type
response["id"] = booking.getId() # response["@id"].split("/")[-1]
response["UID"] = response["booking_id"]
response["gate"] = response["booking_gate"]
response["id"] = response["@id"].split("/")[-1]
response["booking_folder_uid"] = (
response["booking_folder"]["uid"] if "booking_folder" in response else None
)
Expand Down
3 changes: 3 additions & 0 deletions src/design/plone/ioprenoto/tests/test_booking_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def test_get_bookings(self):
)
self.assertEqual(res.status_code, 200)
booking = res.json()
self.assertIn("@id", booking)
self.assertEqual(booking["id"], "mario-rossi")
self.assertEqual(
booking["booking_folder"]["@id"],
self.prenotazioni_folder.absolute_url(),
Expand All @@ -204,6 +206,7 @@ def test_get_bookings(self):
self.assertEqual(res.status_code, 200)
self.assertEqual(len(res.json()["items"]), 1)
booking_info = res.json()["items"][0]
self.assertIn("@id", booking_info)
self.assertEqual(
booking_info["booking_folder"]["@id"],
self.prenotazioni_folder.absolute_url(),
Expand Down

0 comments on commit fb144b0

Please sign in to comment.