Hello everyone!
Using SQLAlchemy, I have two schema classes: guests and bookings. Among others, I have two independent services that return the details of a guest and the details of a booking. Now I’d like to have a service that returns the details of a guest and a list of (the details of) all his/her bookings.
There is a similar example in the docs. What I’d like to have is, for instance, something like:
{
"id": 1,
"name": "Isaac",
"surname": "Newton",
"gender": 1,
"email": "inewton@gmail.com",
"birthdate": "1643-01-04",
[..]
"deleted": null
"reservations": [
{
"id": 30,
"id_room": 1
"reserved": "2016-03-01",
"guests": 2,
"check_in": "2016-07-11",
"check_out": "2016-07-19",
"base_price": 110.70,
[..]
"cancelled": null
},
{
"id": 956,
"id_room": 1
"reserved": "2018-08-21",
"guests": 2,
"check_in": "2018-09-14",
"check_out": "2018-09-21",
"base_price": 120.60,
[..]
"cancelled": null
},
{
"id": 2,
"id_room": 1
"reserved": "2018-08-21",
"guests": 2,
"check_in": "2018-09-14",
"check_out": "2018-09-21",
"base_price": 120.60,
[..]
"cancelled": null
}
],
"rooms": [
{
"id": 2,
"number": "101",
"name": "Double bedroom with sea views",
[..]
},
{
"id": 9,
"number": "205",
"name": "Double bedroom",
[..]
}
]
}
So far I have been able to implement of the services in my test application using SimpleIO, but I am not sure I can use it with this one (return a multilevel JSON document with lists of items inside).
Is it possible? If so, how?
Thanks.