From 8e1db614bfb89e7d9354f3ca6c4b8f1836dec84a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD?= Date: Thu, 8 Jan 2026 12:05:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B7=D0=B0=20=D0=B4=D0=BB=D1=8F?= =?UTF-8?q?=20=D1=80=D1=83=D1=87=D0=BA=D0=B8=20PostUserMedicationsExecutor?= =?UTF-8?q?.h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PostUserMedicationsExecutor.h | 31 ++----------------- 1 file changed, 2 insertions(+), 29 deletions(-) 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; - } }; }