This component is part of the the distributed system DENTISTIMO, a web application that offers a geolocalisation based dental care booking system. The booking handler takes care of requests regarding bookings. More details can be found in the component diagram in the documentation repository.
- Listen to MQTT broker for booking data from front end
- Save booking to database
- Delete one booking from database
- Publish outcome of data maniuplation via mqtt
The component expects stringified json objects sent via MQTT.
The json objects should have at least these information for the following tasks:
- Save a new booking: a json object following the booking schema:
example
{ "name": "Peter",
"userID": {"$oid": "61a63f2b8a42f95c0b120a5a"},
"clinicID": {"$oid": "61a63f2b8a42f95c0b120a5a"},
"date": "23/12/2019",
"startTime": "9:00",
"endTime": "8:00",
}
- Delete a booking: the booking database id
- Retrieve a booking from the database: the booking database id
- Retreive all bookings of a given customer: the customer database id
example
{ "_id": {
"$oid": "61a63f2b8a42f95c0b120a5a"
},
...
}
The component sends stringified json objects. The format varies based on the request:
- Save a new booking: a stringified json object of the saved booking data:
- Delete a booking: a stringified json object of the deleted booking data
- Retrieve a booking from the database: a stringified json object of the saved booking data
- Retreive all bookings of a given customer: a collection of stringified json objects having of a same customer
You need to have a running version of MQTT on your machine. Please refer to this link to download the mosquitto broker if you do not have any.
To download the latest version of node.js, please follow this link
In the window of your broker, you should see a message similar to this:
1638885841: New client connected from 127.0.0.1:49531 as Dentistimo Team5 - Booking Handler n°3c1ff99e (p2, c1, k60).
The booking handler is now ready to proceed your requests.
When starting the component using npm start
, the following message will appear in the terminal:
To unsubscribe, simply follow the commands specified in terminal:
x
and then press enter