diff --git a/include/engine/api/match_api.hpp b/include/engine/api/match_api.hpp index f2110ada1..3fb95523b 100644 --- a/include/engine/api/match_api.hpp +++ b/include/engine/api/match_api.hpp @@ -49,10 +49,22 @@ class MatchAPI final : public RouteAPI const std::vector &sub_routes, flatbuffers::FlatBufferBuilder &fb_result) const { + auto data_timestamp = facade.GetTimestamp(); + boost::optional> data_version_string = boost::none; + if (!data_timestamp.empty()) + { + data_version_string = fb_result.CreateString(data_timestamp); + } + auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_matchings]() { return MakeTracepoints(fb_result, sub_matchings); }); + if (data_version_string) + { + response.add_data_version(*data_version_string); + } + fb_result.Finish(response.Finish()); } void MakeResponse(const std::vector &sub_matchings, diff --git a/include/engine/api/nearest_api.hpp b/include/engine/api/nearest_api.hpp index fc487358b..a10d424b2 100644 --- a/include/engine/api/nearest_api.hpp +++ b/include/engine/api/nearest_api.hpp @@ -47,6 +47,13 @@ class NearestAPI final : public BaseAPI void MakeResponse(const std::vector> &phantom_nodes, flatbuffers::FlatBufferBuilder &fb_result) const { + auto data_timestamp = facade.GetTimestamp(); + boost::optional> data_version_string = boost::none; + if (!data_timestamp.empty()) + { + data_version_string = fb_result.CreateString(data_timestamp); + } + std::vector> waypoints; waypoints.resize(phantom_nodes.front().size()); std::transform(phantom_nodes.front().begin(), @@ -67,6 +74,10 @@ class NearestAPI final : public BaseAPI auto waypoints_vector = fb_result.CreateVector(waypoints); fbresult::FBResultBuilder response(fb_result); response.add_waypoints(waypoints_vector); + if (data_version_string) + { + response.add_data_version(*data_version_string); + } fb_result.Finish(response.Finish()); } void MakeResponse(const std::vector> &phantom_nodes, diff --git a/include/engine/api/table_api.hpp b/include/engine/api/table_api.hpp index f9fb245b5..7b6cd1c48 100644 --- a/include/engine/api/table_api.hpp +++ b/include/engine/api/table_api.hpp @@ -72,6 +72,13 @@ class TableAPI final : public BaseAPI auto number_of_sources = parameters.sources.size(); auto number_of_destinations = parameters.destinations.size(); + auto data_timestamp = facade.GetTimestamp(); + boost::optional> data_version_string = boost::none; + if (!data_timestamp.empty()) + { + data_version_string = fb_result.CreateString(data_timestamp); + } + // symmetric case flatbuffers::Offset>> sources; if (parameters.sources.empty()) @@ -134,7 +141,10 @@ class TableAPI final : public BaseAPI auto table_buffer = table.Finish(); fbresult::FBResultBuilder response(fb_result); - + if (data_version_string) + { + response.add_data_version(*data_version_string); + } response.add_table(table_buffer); response.add_waypoints(sources); fb_result.Finish(response.Finish()); diff --git a/include/engine/api/trip_api.hpp b/include/engine/api/trip_api.hpp index 90cc395b9..518d0ec7d 100644 --- a/include/engine/api/trip_api.hpp +++ b/include/engine/api/trip_api.hpp @@ -47,11 +47,22 @@ class TripAPI final : public RouteAPI const std::vector &phantoms, flatbuffers::FlatBufferBuilder &fb_result) const { + auto data_timestamp = facade.GetTimestamp(); + boost::optional> data_version_string = boost::none; + if (!data_timestamp.empty()) + { + data_version_string = fb_result.CreateString(data_timestamp); + } + auto response = MakeFBResponse(sub_routes, fb_result, [this, &fb_result, &sub_trips, &phantoms]() { return MakeWaypoints(fb_result, sub_trips, phantoms); }); + if (data_version_string) + { + response.add_data_version(*data_version_string); + } fb_result.Finish(response.Finish()); } void MakeResponse(const std::vector> &sub_trips,