Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
3279bda9
Commit
3279bda9
authored
Jul 19, 2022
by
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
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/jsapi/jsonld.cpp
View file @
3279bda9
...
...
@@ -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"
},
...
...
src/lib/jsapi/jsonld.h
View file @
3279bda9
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment