🎨 stylistic change to list init for pairs

This commit is contained in:
EntireTwix 2021-07-19 22:08:09 -07:00
parent 91609f1840
commit 34099acd02
3 changed files with 11 additions and 11 deletions

View file

@ -147,7 +147,7 @@ void api::SetBal(req_args) const
auto amount = doc.find_field("amount").get_uint64();
if (name.error() || amount.error())
{
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
}
else
{
@ -171,7 +171,7 @@ void api::ImpactBal(req_args) const
auto amount = doc.find_field("amount").get_int64();
if (name.error() || amount.error())
{
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
}
else
{
@ -200,11 +200,11 @@ void api::Contains(req_args, const std::string &name) const
BankResponse res;
if (bank.Contains(name))
{
res = BankResponse(k204NoContent, std::nullopt);
res = BankResponse{k204NoContent, std::nullopt};
}
else
{
res = BankResponse(k404NotFound, "\"User not found\"");
res = BankResponse{k404NotFound, "\"User not found\""};
}
RESPONSE_PARSE(std::move(res));
}
@ -242,7 +242,7 @@ void api::AddUser(req_args) const
auto pass = doc.find_field("pass").get_string();
if (name.error() || pass.error())
{
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
}
else
{
@ -268,7 +268,7 @@ void api::AdminAddUser(req_args) const
auto pass = doc.find_field("pass").get_string();
if (name.error() || amount.error() || pass.error())
{
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
}
else
{
@ -297,7 +297,7 @@ void api::AdminDelUser(req_args) const
auto name = doc.find_field("name").get_string();
if (name.error())
{
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
}
else
{

View file

@ -22,7 +22,7 @@ void JsonFilter<check_content_type>::doFilter(const HttpRequestPtr &req,
fccb();
return;
}
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k406NotAcceptable, "\"Client must Accept and have content-type of JSON\""));
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse{k406NotAcceptable, "\"Client must Accept and have content-type of JSON\""});
fcb(resp);
}
else
@ -32,7 +32,7 @@ void JsonFilter<check_content_type>::doFilter(const HttpRequestPtr &req,
fccb();
return;
}
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse(k406NotAcceptable, "\"Client must Accept JSON\""));
const auto &resp = HttpResponse::newCustomHttpResponse(BankResponse{k406NotAcceptable, "\"Client must Accept JSON\""});
fcb(resp);
}
}

View file

@ -43,7 +43,7 @@ void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &re
{
if constexpr (require_admin)
{
if (bank.AdminVerifyAccount(username.str))
if (bank.admin_account == username.str)
{
StrFromSV_Wrapper password(results_view.substr(middle + 1));
if (bank.VerifyPassword(username.str, password.str))
@ -70,7 +70,7 @@ void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &re
}
}
}
fcb(HttpResponse::newCustomHttpResponse(BankResponse(k401Unauthorized, "\"Invalid Credentials\"")));
fcb(HttpResponse::newCustomHttpResponse(BankResponse{k401Unauthorized, "\"Invalid Credentials\""}));
}
template class UserFilter<true, false>; //user default