Move freelancer listing to utilities
This commit is contained in:
@ -27,14 +27,9 @@ int main(int argc, char *argv[]) {
|
|||||||
* Freelancer Profile listing for customers
|
* Freelancer Profile listing for customers
|
||||||
*/
|
*/
|
||||||
CROW_ROUTE(app, "/").methods("POST"_method, "GET"_method)
|
CROW_ROUTE(app, "/").methods("POST"_method, "GET"_method)
|
||||||
([databaseURI]() {
|
([configuration]() {
|
||||||
pqxx::connection databaseConnection(databaseURI);
|
|
||||||
pqxx::result result = Database::executeStatement_SELECT_FREELANCERS_WITHCOMMISSIONSSTATE(databaseConnection);
|
|
||||||
|
|
||||||
auto page = crow::mustache::load("customerIndex_FreelancerListing.html");
|
auto page = crow::mustache::load("customerIndex_FreelancerListing.html");
|
||||||
crow::json::wvalue resultJson = Database::convertResultToJSON(result, "freelancerProfiles");
|
crow::mustache::context ctx(Utilities::getFreelancerListing(configuration));
|
||||||
|
|
||||||
crow::mustache::context ctx(resultJson);
|
|
||||||
return page.render(ctx);
|
return page.render(ctx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -269,4 +269,14 @@ namespace Utilities {
|
|||||||
return resultJsonAlias;
|
return resultJsonAlias;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Gets The freelancer listing
|
||||||
|
* takes configuration
|
||||||
|
* returns crow::json::wvalue with the Freelancer profile listing
|
||||||
|
*/
|
||||||
|
crow::json::wvalue getFreelancerListing(const Utilities::config& configuration) {
|
||||||
|
pqxx::connection databaseConnection(configuration.databaseConnectionString);
|
||||||
|
pqxx::result result = Database::executeStatement_SELECT_FREELANCERS_WITHCOMMISSIONSSTATE(databaseConnection);
|
||||||
|
return Database::convertResultToJSON(result, "freelancerProfiles");
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user