mirror of
https://github.com/Expand-sys/CCash
synced 2026-03-22 20:47:10 +11:00
🎨 stylistic change to list init for pairs
This commit is contained in:
parent
91609f1840
commit
34099acd02
3 changed files with 11 additions and 11 deletions
|
|
@ -147,7 +147,7 @@ void api::SetBal(req_args) const
|
||||||
auto amount = doc.find_field("amount").get_uint64();
|
auto amount = doc.find_field("amount").get_uint64();
|
||||||
if (name.error() || amount.error())
|
if (name.error() || amount.error())
|
||||||
{
|
{
|
||||||
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
|
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -171,7 +171,7 @@ void api::ImpactBal(req_args) const
|
||||||
auto amount = doc.find_field("amount").get_int64();
|
auto amount = doc.find_field("amount").get_int64();
|
||||||
if (name.error() || amount.error())
|
if (name.error() || amount.error())
|
||||||
{
|
{
|
||||||
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
|
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -200,11 +200,11 @@ void api::Contains(req_args, const std::string &name) const
|
||||||
BankResponse res;
|
BankResponse res;
|
||||||
if (bank.Contains(name))
|
if (bank.Contains(name))
|
||||||
{
|
{
|
||||||
res = BankResponse(k204NoContent, std::nullopt);
|
res = BankResponse{k204NoContent, std::nullopt};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
res = BankResponse(k404NotFound, "\"User not found\"");
|
res = BankResponse{k404NotFound, "\"User not found\""};
|
||||||
}
|
}
|
||||||
RESPONSE_PARSE(std::move(res));
|
RESPONSE_PARSE(std::move(res));
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +242,7 @@ void api::AddUser(req_args) const
|
||||||
auto pass = doc.find_field("pass").get_string();
|
auto pass = doc.find_field("pass").get_string();
|
||||||
if (name.error() || pass.error())
|
if (name.error() || pass.error())
|
||||||
{
|
{
|
||||||
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
|
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -268,7 +268,7 @@ void api::AdminAddUser(req_args) const
|
||||||
auto pass = doc.find_field("pass").get_string();
|
auto pass = doc.find_field("pass").get_string();
|
||||||
if (name.error() || amount.error() || pass.error())
|
if (name.error() || amount.error() || pass.error())
|
||||||
{
|
{
|
||||||
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
|
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -297,7 +297,7 @@ void api::AdminDelUser(req_args) const
|
||||||
auto name = doc.find_field("name").get_string();
|
auto name = doc.find_field("name").get_string();
|
||||||
if (name.error())
|
if (name.error())
|
||||||
{
|
{
|
||||||
res = BankResponse(k400BadRequest, "\"Missing JSON arg(s)\"");
|
res = BankResponse{k400BadRequest, "\"Missing JSON arg(s)\""};
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ void JsonFilter<check_content_type>::doFilter(const HttpRequestPtr &req,
|
||||||
fccb();
|
fccb();
|
||||||
return;
|
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);
|
fcb(resp);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -32,7 +32,7 @@ void JsonFilter<check_content_type>::doFilter(const HttpRequestPtr &req,
|
||||||
fccb();
|
fccb();
|
||||||
return;
|
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);
|
fcb(resp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ void UserFilter<set_body_flag, require_admin>::doFilter(const HttpRequestPtr &re
|
||||||
{
|
{
|
||||||
if constexpr (require_admin)
|
if constexpr (require_admin)
|
||||||
{
|
{
|
||||||
if (bank.AdminVerifyAccount(username.str))
|
if (bank.admin_account == username.str)
|
||||||
{
|
{
|
||||||
StrFromSV_Wrapper password(results_view.substr(middle + 1));
|
StrFromSV_Wrapper password(results_view.substr(middle + 1));
|
||||||
if (bank.VerifyPassword(username.str, password.str))
|
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
|
template class UserFilter<true, false>; //user default
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue