24 #include "tools/LogEntry_odb.h" 38 return std::make_unique<LogGet>(ctx);
47 using namespace Tools;
48 using namespace JSONUtil;
50 rep[
"data"] = json::array();
57 LogEntry::QueryResult result = LogEntry::retrieve(db, p, ps, sort ==
"asc");
60 auto timestamp = boost::posix_time::to_time_t(entry.
timestamp_);
61 rep[
"data"].push_back(
63 {
"type",
"log-message"},
65 {{
"message", entry.
msg_}, {
"timestamp", timestamp}}}});
69 {
"total", result.total}, {
"last", result.last}, {
"first", result.first}};
81 std::vector<ActionActionParam> perm_;
std::chrono::system_clock::time_point extract_with_default(const nlohmann::json &obj, const std::string &key, const std::chrono::system_clock::time_point &tp)
Extract an ISO 8601 datetime string from a json object.
The base class for API method handler implementation.
This is the header file for a generated source file, GitSHA1.cpp.
virtual json process_impl(const json &req) override
The API method implementation.
boost::posix_time::ptime timestamp_
std::unique_ptr< MethodHandler > MethodHandlerUPtr
static MethodHandlerUPtr create(RequestContext)
LogGet(RequestContext ctx)
All modules that provides features to Leosac shall be in this namespace.
Holds valuable pointer to provide context to a request.
std::shared_ptr< odb::database > DBPtr
std::vector< ActionActionParam > required_permission(const json &req) const override
Return a list of "Action" / "ActionParam" that must pass before the request is processed.