+++ /customer/$freelancer/template/$templateName
Route handling the display of a Template And minor fix enabling the root route to handle post
This commit is contained in:
29
src/main.cpp
29
src/main.cpp
@ -25,7 +25,7 @@ int main() {
|
||||
/*
|
||||
* Freelancer Profile listing for customers
|
||||
*/
|
||||
CROW_ROUTE(app, "/")
|
||||
CROW_ROUTE(app, "/").methods("POST"_method)
|
||||
([databaseURI]() {
|
||||
pqxx::connection databaseConnection(databaseURI);
|
||||
pqxx::result result = Database::executeStatement_SELECT_FREELANCERS_WITHCOMMISSIONSSTATE(databaseConnection);
|
||||
@ -79,6 +79,33 @@ int main() {
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* Page representing a freelancers Template
|
||||
*/
|
||||
CROW_ROUTE(app, "/customer/<string>/template/<string>").methods("POST"_method)
|
||||
([databaseURI](const crow::request& postRequest, string freelancerName, string templateName ) {
|
||||
int templateID = stoi(Utilities::extractSingleValueFromRequestBody(postRequest.body.c_str(), "templateID"));
|
||||
|
||||
pqxx::connection databaseConnection(databaseURI);
|
||||
pqxx::result resultTemplate = Database::executePreparedStatement_SELECT_TEMPLATE(databaseConnection, templateID);
|
||||
|
||||
crow::json::wvalue resultJsonTemplate = Database::convertResultRowToJSON(resultTemplate);
|
||||
|
||||
string templateHTML = "customer_Freelancer_Template.html";
|
||||
auto page = crow::mustache::load(templateHTML);
|
||||
|
||||
crow::mustache::context ctx(resultJsonTemplate);
|
||||
return page.render(ctx);
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user