diff --git a/src/endpoints_handlers/PostUserMedicationsExecutor.h b/src/endpoints_handlers/PostUserMedicationsExecutor.h index 71b189a..0d06af8 100644 --- a/src/endpoints_handlers/PostUserMedicationsExecutor.h +++ b/src/endpoints_handlers/PostUserMedicationsExecutor.h @@ -40,9 +40,9 @@ public: using namespace std::string_view_literals; constexpr std::string_view auth_prefix = "Bearer "sv; - static const std::string invalid_token_message = "GET /api/v1/User/Medications - Response 401: Unauthorized"s; + static const std::string invalid_token_message = "POST /api/v1/User/Medications - Response 401: Unauthorized"s; - BOOST_LOG_TRIVIAL(info) << "GET /api/v1/User/Medications - Request"; + BOOST_LOG_TRIVIAL(info) << "POST /api/v1/User/Medications - Request"; if (req[http::field::authorization].size() <= auth_prefix.size()) { @@ -59,15 +59,6 @@ public: } http::response res{http::status::ok, req.version()}; - const std::vector medications = medications_dao_->GetAll(); - value response_body; - - response_body.emplace_object(); - response_body.as_object().emplace("medications", toJSONArray(medications)); - - res.body() = serialize(response_body); - res.set(http::field::content_type, "application/json"); - res.content_length(res.body().size()); return res; } @@ -83,23 +74,5 @@ private: { "is_urgent", m.is_urgent } }; } - - boost::json::array toJSONArray(const std::vector& medications) - { - using namespace boost; - using namespace boost::json; - using namespace boost::beast; - using namespace std::string_literals; - using namespace std::string_view_literals; - - json::array arr; - - for (const auto& m : medications) - { - arr.emplace_back(ToJSON(m)); - } - - return arr; - } }; }