| 12345678910111213141516171819202122232425262728 |
- from .reservation import reservation
- from .reservations_collection import reservations_collection
- class reservations_response:
- def collection(self, targets: list) -> list:
- result = list()
- for count in targets:
- if not isinstance(count, reservation):
- raise TypeError("Reservations list not contain reservation.")
- result.append(self.single(count))
- return result
- def single(self, target: reservation) -> dict:
- response = {
- "target_name": target.target.name,
- "target_barcode": target.target.barcode
- }
-
- if target.email is not None:
- response["email"] = target.email
- if target.phone_number is not None:
- response["phone_number"] = target.phone_number
- return response
|