Commit 3279bda9 authored by Volker Krause's avatar Volker Krause
Browse files

Add JS API for creating ferry/boat trip reservation objects

parent 660bd99e
Pipeline #206834 passed with stage
in 8 minutes and 9 seconds
......@@ -173,6 +173,25 @@ QJSValue JsApi::JsonLd::newRentalCarReservation() const
return res;
}
QJSValue JsApi::JsonLd::newBoatReservation() const
{
const auto dep = newPlace(QStringLiteral("BoatTerminal"));
const auto arr = newPlace(QStringLiteral("BoatTerminal"));
const auto person = newObject(QStringLiteral("Person"));
const auto ticket = newObject(QStringLiteral("Ticket"));
auto resFor = newObject(QStringLiteral("BoatTrip"));
resFor.setProperty(QStringLiteral("departureBoatTerminal"), dep);
resFor.setProperty(QStringLiteral("arrivalBoatTerminal"), arr);
auto res = newObject(QStringLiteral("BoatReservation"));
res.setProperty(QStringLiteral("reservationFor"), resFor);
res.setProperty(QStringLiteral("underName"), person);
res.setProperty(QStringLiteral("reservedTicket"), ticket);
return res;
}
static constexpr const JsonLdFilterEngine::TypeMapping train_to_bus_type_map[] = {
{ "TrainReservation", "BusReservation" },
{ "TrainStation", "BusStation" },
......
......@@ -56,6 +56,10 @@ public:
* This can be used by extractor scripts to fill in the extracted information.
*/
Q_INVOKABLE QJSValue newRentalCarReservation() const;
/** Convenience method that generates a full BoatReservation JS object.
* This can be used by extractor scripts to fill in the extracted information.
*/
Q_INVOKABLE QJSValue newBoatReservation() const;
/** Convert a train reservation to a bus reservation. */
Q_INVOKABLE QJSValue trainToBusReservation(const QJSValue &trainRes) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment