Get a list of current bookings of an enrolment, and a list of available casual sessions to book.
service(id: 979) {
id
sessionsAvailable(startDate: "2021-12-29", endDate: "2021-12-30", enrolmentId: "sfdev_22053") {
date
enrolmentId
bookingId
productId
room
code
fee
startTime
endTime
status
absent
}
}
The result looks like this:
{"data":{"service":{"id":"sfdev_979","sessionsAvailable":[
{"date":"2021-12-30","childId":null,"enrolmentId":"sfdev_22053","bookingId":"sfdev_2034","productId":null,"startTime":"07:00:00","endTime":"18:00:00","fee":110.0,"room":"Newts","code":"Casual","status":"booked"},
{"date":"2021-12-30","childId":null,"enrolmentId":null,"bookingId":null,"productId":"sfdev_40","startTime":"07:00:00","endTime":"18:00:00","fee":110.0,"room":"Tadpoles","code":"Casual","status":"open"},
{"date":"2021-12-30","childId":null,"enrolmentId":null,"bookingId":null,"productId":"sfdev_41","startTime":"07:00:00","endTime":"18:00:00","fee":110.0,"room":"Tadpoles","code":"Casual","status":"open"}]}}}
Sessions with status ‘booked’ are the current bookings of the enrolment.
Sessions with status ‘open’ are the available sessions ready to be booked.
Pick a ‘session product’, send its productId and user’s enrolment id.
mutation {
createSession(productId: "sfdev_41", enrolmentId: "sfdev_22053") {
errors
session {
date
bookingId
}
}
}
Done.
{"data":{"createSession":{"errors":[],"session":{
"date":"2021-12-30","bookingId":"sfdev_2633"}
}}}
There is no step 3.