implementation of the edit function for the template managment

+minor typo fixes
This commit is contained in:
Tina_Azure
2023-05-17 18:39:32 +02:00
parent d9f3fd711c
commit 1620967c45
3 changed files with 37 additions and 9 deletions

View File

@ -308,7 +308,7 @@ namespace Database {
/*
* Executes the prepared statement SELECT_CHECK_EMAIL_EXISTS
* Takes an open pqxx::connection and the emailAddress to check
* Delivers count of emailaddress occurence 0 for none 1+ for more
* Delivers count of emailaddress occurrence 0 for none 1+ for more
*/
pqxx::result executePreparedStatement_SELECT_CHECK_EMAIL_EXISTS(pqxx::connection &connection, const std::string& freelancerEmail) {
pqxx::work work(connection);
@ -320,7 +320,7 @@ namespace Database {
/*
* Executes the prepared statement SELECT_CHECK_FREELANCER_LOGIN_STATE
* Takes an open pqxx::connection the loginKey and the id to check
* Delivers count of loginValidationKey occurence 0 for none 1+ for more
* Delivers count of loginValidationKey occurrence 0 for none 1+ for more
*/
pqxx::result executePreparedStatement_SELECT_CHECK_FREELANCER_LOGIN_STATE(pqxx::connection &connection, const std::string& freelancerEmail, const std::string& loginKey) {
pqxx::work work(connection);
@ -575,6 +575,18 @@ namespace Database {
return 0;
}
/*
* Executes the prepared statement UPDATE_EDIT_FREELANCER_TEMPLATE
* Takes an open pqxx::connection name, content, contactdata, contactinformation, currencypreference, priceupfront, priceondeliver, templateid and the freelancers email
* returns true if update occured
*/
bool executePreparedStatement_UPDATE_EDIT_FREELANCER_TEMPLATE(pqxx::connection &connection, const std::string& name, const std::string& content, const std::string& contactdata, const std::string& contactinformation, const std::string& currencypreference, const std::string& priceupfront, const std::string& priceondeliver, int templateid, const std::string& emailAddress) {
pqxx::work work(connection);
pqxx::result result = work.exec_prepared(PREPARED_STATEMENT_UPDATE_EDIT_FREELANCER_TEMPLATE, name, content, contactdata, contactinformation, currencypreference, priceupfront, priceondeliver, templateid, emailAddress);
work.commit();
return result.affected_rows() != 0;
}
/*
* Executes the prepared statement DELETE_FREELANCER_TEMPLATE
* Deletes a templated based on the id and validated with the freelancer email