![]() |
Mantis App v0.1.13
|
Class to model the behaviour of a table in database. More...
#include <tables.h>
Public Member Functions | |
TableUnit (std::string tableName, std::string tableId, std::string tableType="base") | |
TableUnit (const json &schema=json::object()) | |
virtual | ~TableUnit () override=default |
virtual void | fetchRecord (const Request &req, Response &res, Context &ctx) |
virtual void | fetchRecords (const Request &req, Response &res, Context &ctx) |
virtual void | createRecord (const Request &req, Response &res, Context &ctx) |
virtual void | updateRecord (const Request &req, Response &res, Context &ctx) |
virtual void | deleteRecord (const Request &req, Response &res, Context &ctx) |
virtual void | authWithEmailAndPassword (const Request &req, Response &res, Context &ctx) |
virtual void | resetPassword (const Request &req, Response &res, Context &ctx) |
virtual bool | setupRoutes () |
void | setRouteDisplayName (const std::string &routeName) |
virtual bool | hasAccess (const Request &req, Response &res, Context &ctx) |
std::string | tableName () |
void | setTableName (const std::string &name) |
std::string | tableId () |
void | setTableId (const std::string &id) |
std::string | tableType () |
void | fromJson (const json &j) |
std::vector< json > | fields () const |
void | setFields (const std::vector< json > &fields) |
bool | isSystem () const |
void | setIsSystemTable (bool isSystemTable) |
Rule | listRule () |
void | setListRule (const Rule &rule) |
Rule | getRule () |
void | setGetRule (const Rule &rule) |
Rule | addRule () |
void | setAddRule (const Rule &rule) |
Rule | updateRule () |
void | setUpdateRule (const Rule &rule) |
Rule | deleteRule () |
void | setDeleteRule (const Rule &rule) |
json | create (const json &entity, const json &opts) override |
std::optional< json > | read (const std::string &id, const json &opts) override |
json | update (const std::string &id, const json &entity, const json &opts) override |
bool | remove (const std::string &id, const json &opts) override |
std::vector< json > | list (const json &opts) override |
std::string | getColTypeFromName (const std::string &col, const std::vector< json > &fields) const |
json | parseDbRowToJson (const soci::row &row) const |
std::optional< json > | validateRequestBody (const json &body) const |
std::optional< json > | validateUpdateRequestBody (const json &body) const |
bool | recordExists (const std::string &id) const |
std::optional< json > | findFieldByKey (const std::string &key) const |
json | checkValueInColumns (const std::string &value, const std::vector< std::string > &columns) const |
![]() | |
virtual | ~CrudInterface ()=default |
Static Public Member Functions | |
static bool | getAuthToken (const Request &req, Response &res, Context &ctx) |
static std::string | generateTableId (const std::string &tablename) |
Public Attributes | |
const std::string | __class_name__ = "TableUnit" |
Protected Attributes | |
std::string | m_tableName |
std::string | m_tableId |
std::string | m_tableType |
std::string | m_routeName |
bool | m_isSystem = false |
std::vector< json > | m_fields = {} |
Rule | m_listRule |
Rule | m_getRule |
Rule | m_addRule |
Rule | m_updateRule |
Rule | m_deleteRule |
Class to model the behaviour of a table in database.
This will encompass:
|
explicit |
|
explicit |
|
overridevirtualdefault |
Rule mantis::TableUnit::addRule | ( | ) |
|
virtual |
Reimplemented in mantis::SysTablesUnit.
json mantis::TableUnit::checkValueInColumns | ( | const std::string & | value, |
const std::vector< std::string > & | columns | ||
) | const |
Implements mantis::CrudInterface< json >.
Reimplemented in mantis::SysTablesUnit.
Reimplemented in mantis::SysTablesUnit.
Rule mantis::TableUnit::deleteRule | ( | ) |
Reimplemented in mantis::SysTablesUnit.
Reimplemented in mantis::SysTablesUnit.
std::vector< json > mantis::TableUnit::fields | ( | ) | const |
std::optional< json > mantis::TableUnit::findFieldByKey | ( | const std::string & | key | ) | const |
void mantis::TableUnit::fromJson | ( | const json & | j | ) |
|
static |
std::string mantis::TableUnit::getColTypeFromName | ( | const std::string & | col, |
const std::vector< json > & | fields | ||
) | const |
Rule mantis::TableUnit::getRule | ( | ) |
Reimplemented in mantis::SysTablesUnit.
bool mantis::TableUnit::isSystem | ( | ) | const |
Implements mantis::CrudInterface< json >.
Rule mantis::TableUnit::listRule | ( | ) |
json mantis::TableUnit::parseDbRowToJson | ( | const soci::row & | row | ) | const |
|
overridevirtual |
Implements mantis::CrudInterface< json >.
bool mantis::TableUnit::recordExists | ( | const std::string & | id | ) | const |
|
overridevirtual |
Implements mantis::CrudInterface< json >.
|
virtual |
void mantis::TableUnit::setAddRule | ( | const Rule & | rule | ) |
void mantis::TableUnit::setDeleteRule | ( | const Rule & | rule | ) |
void mantis::TableUnit::setFields | ( | const std::vector< json > & | fields | ) |
void mantis::TableUnit::setGetRule | ( | const Rule & | rule | ) |
void mantis::TableUnit::setIsSystemTable | ( | bool | isSystemTable | ) |
void mantis::TableUnit::setListRule | ( | const Rule & | rule | ) |
void mantis::TableUnit::setRouteDisplayName | ( | const std::string & | routeName | ) |
void mantis::TableUnit::setTableId | ( | const std::string & | id | ) |
void mantis::TableUnit::setTableName | ( | const std::string & | name | ) |
void mantis::TableUnit::setUpdateRule | ( | const Rule & | rule | ) |
|
virtual |
Reimplemented in mantis::SysTablesUnit.
std::string mantis::TableUnit::tableId | ( | ) |
std::string mantis::TableUnit::tableName | ( | ) |
std::string mantis::TableUnit::tableType | ( | ) |
|
overridevirtual |
Implements mantis::CrudInterface< json >.
Reimplemented in mantis::SysTablesUnit.
Rule mantis::TableUnit::updateRule | ( | ) |
const std::string mantis::TableUnit::__class_name__ = "TableUnit" |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |