Freelancer Profile Listing

-Template, Database access, Handler
-Freelancer Database Table
This commit is contained in:
Tina_Azure
2023-04-02 00:27:02 +02:00
parent b90f72f61a
commit 04e41c2dce
4 changed files with 167 additions and 9 deletions

View File

@ -8,10 +8,6 @@ using namespace std;
int main() {
crow::SimpleApp app;
//define your endpoint at the root directory
CROW_ROUTE(app, "/")([]() {
return "Hello world";
});
// CROW_ROUTE(app, "/test.json")
// ([](){
@ -25,6 +21,29 @@ int main() {
string databaseURI = "postgresql://cavecommadmin:cavecomm@localhost:5432/cavecomm";
/*
* Freelancer Profile listing for customers
*/
CROW_ROUTE(app, "/")
([databaseURI]() {
pqxx::connection databaseConnection(databaseURI);
pqxx::result result = Database::executeStatement_SELECT_FREELANCERS_WITHCOMMISSIONSSTATE(databaseConnection);
auto page = crow::mustache::load("customerIndex_FreelancerListing.html");
crow::json::wvalue resultJson = Database::convertResultToJSON(result, "freelancerProfiles");
crow::mustache::context ctx(resultJson);
return page.render(ctx);
});
CROW_ROUTE(app, "/getEntry/<int>")
([databaseURI](int entry) {
pqxx::connection databaseConnection(databaseURI);