diff --git a/README.md b/README.md index f394212..2021c15 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,10 @@ - Написать фронтенд для MVP - Разобрать decltype и auto по статье До 27.01.2026 -- Подобрать сервер по параметрам. Использовать linux. +- ~~Подобрать сервер по параметрам. Использовать linux.~~ DockerHosting.ru - Перевести string на string_view - ~~Попробовать nodiscard к executoru~~ -- Добить 2 ручки +- ~~Добить 2 ручки~~ - Сделать тесты для ручек # План diff --git a/src/endpoints_handlers/AuthRegistrationExecutor.h b/src/endpoints_handlers/AuthRegistrationExecutor.h index 46a9810..8f1c24d 100644 --- a/src/endpoints_handlers/AuthRegistrationExecutor.h +++ b/src/endpoints_handlers/AuthRegistrationExecutor.h @@ -97,16 +97,16 @@ public: } private: - bool ValidateLogin(const std::string& login) + bool ValidateLogin(std::string_view login) { if (login.size() < 3 || login.size() > 50) return false; std::regex pattern(std::string("^[A-Za-z0-9_]+$")); - return std::regex_match(login, pattern); + return std::regex_match(login.data(), pattern); } - bool ValidatePassword(const std::string& password) + bool ValidatePassword(std::string_view password) { return password.size() >= 5; } diff --git a/src/endpoints_handlers/RootExecutor.h b/src/endpoints_handlers/RootExecutor.h index 32308b0..42f499a 100644 --- a/src/endpoints_handlers/RootExecutor.h +++ b/src/endpoints_handlers/RootExecutor.h @@ -166,13 +166,12 @@ public: { namespace urls = boost::urls; - const std::string& route = req.target(); - const bool is_match_route = routes_pathes_.count(route); + const bool is_match_route = routes_pathes_.count(req.target()); if (is_match_route) { std::optional> maybe_executor_ptr = routes_pathes_ - .at(route) + .at(req.target()) ->FindExecutor(req.method()); if (maybe_executor_ptr.has_value()) @@ -192,7 +191,7 @@ public: } } - urls::url_view parsed_view = urls::parse_uri_reference(route).value(); + urls::url_view parsed_view = urls::parse_uri_reference(req.target()).value(); auto segs = parsed_view.segments(); std::vector parts;