Formatted code a bit better.

This commit is contained in:
Pedro Pinto committed 2018-06-08 16:33:11 -04:00
1 parent 01d2e88097
commit a13cececa1
1 file changed
+23 -19
@@ -24,41 +24,45 @@ OrderRouter::RouteQueryResult
OrderRouter::get_routing_record(UserID user_id, AccountID account_id,
api::Security const &sec) const {
api::admin::AdminServiceOperationResult result;
api::orderman::RoutingRecord rr = bts::admin::AdminServiceUtils::get_routing_record(me->data, account_id.value()==0 ? 1 : account_id.value(),
user_id.value()==0 ? 1 : user_id.value(), sec, result);
api::orderman::RoutingRecord rr =
bts::admin::AdminServiceUtils::get_routing_record(
me->data, account_id.value() == 0 ? 1 : account_id.value(),
user_id.value() == 0 ? 1 : user_id.value(), sec, result);
if (result.is_success())
return RouteQueryResult{true, std::string(""), rr};
else
return RouteQueryResult{false, result.error_text(), rr};
}
OrderRouter::ReverseRoutingQueryResult
OrderRouter::get_reverse_routing_record(std::string const &session, std::string const &operator_id, std::string const &account,
api::Security const * sec) const {
ReverseRoutingQueryResult rv {true,"","",UserID(0),"",AccountID(0)};
api::Venue exchange = sec == nullptr ? api::Venue::VENUE_GLBX : sec->exchange();
auto match = bts::admin::AdminServiceUtils::find_user_account_matches(me->data,session,account,operator_id,exchange);
if(match.first != nullptr){
OrderRouter::ReverseRoutingQueryResult OrderRouter::get_reverse_routing_record(
std::string const &session, std::string const &operator_id,
std::string const &account, api::Security const *sec) const {
ReverseRoutingQueryResult rv{true, "", "", UserID(0), "", AccountID(0)};
api::Venue exchange =
sec == nullptr ? api::Venue::VENUE_GLBX : sec->exchange();
auto match = bts::admin::AdminServiceUtils::find_user_account_matches(
me->data, session, account, operator_id, exchange);
if (match.first != nullptr) {
rv.account = match.first->name();
rv.account_id = AccountID(match.first->id());
} else {
rv.ok = false;
rv.error_msg = "Could not resolve account";
}
else{
rv.ok=false;
rv.error_msg = "Could not resolve account";
}
if(match.second != nullptr){
if (match.second != nullptr) {
rv.user = match.second->name();
rv.user_id = UserID(match.second->id());
}
else{
rv.ok=false;
rv.error_msg = (!rv.ok ? std::string(", ") : std::string("")) + "Could not resolve user";
} else {
rv.ok = false;
rv.error_msg = (!rv.ok ? std::string(", ") : std::string("")) +
"Could not resolve user";
}
return rv;
}
bool OrderRouter::is_valid_session(std::string const &session) const {
return bts::admin::AdminServiceUtils::find_connection(me->data, session) != nullptr;
return bts::admin::AdminServiceUtils::find_connection(me->data, session) !=
nullptr;
}
OrderRouter::~OrderRouter() {}