мелкие правки

This commit is contained in:
Антон
2025-10-04 09:54:55 +03:00
parent 2b5e601387
commit 5346bb2849
13 changed files with 51 additions and 158 deletions
+5 -5
View File
@@ -21,14 +21,14 @@ class AuthLogoutExecutor : public IExecutor<Body, Allocator, ResponseType>
public:
AuthLogoutExecutor(mysqlx::Session& session,
const std::shared_ptr<IAuthDAO>& auth_dao)
: session_(session), auth_dao_(auth_dao)
const std::shared_ptr<IAuthDAO>& auth_dao) :
session_(session), auth_dao_(auth_dao)
{
}
boost::beast::http::response<ResponseType> operator ()(
boost::beast::http::request<Body, boost::beast::http::basic_fields<Allocator>>&& req
) override
) override
{
using namespace boost;
using namespace boost::json;
@@ -44,14 +44,14 @@ public:
}
catch (const system::system_error& err)
{
throw exception400_bad_request("cannot deserialize json"s);
throw session_exception(http::status::internal_server_error, "cannot deserialize json"s);
}
const std::string token = req_json.as_object().at("token").as_string().c_str();
if (!auth_dao_->Logout(token))
{
throw exception400_bad_request("token is not authorized"s);
throw session_exception(http::status::bad_request, "token is not authorized"s);
}
http::response<ResponseType> res{http::status::ok, req.version()};