|
#ifndef USERTABLE_H
|
|
#define USERTABLE_H
|
|
|
|
#include "utils/definitions.h"
|
|
#include "db/schema/TestContentTable.h"
|
|
#include <Wt/Dbo/Dbo>
|
|
|
|
class TestContentTable;
|
|
|
|
class UserTable
|
|
{
|
|
private:
|
|
string m_login;
|
|
string m_password;
|
|
string m_name;
|
|
string m_lastname;
|
|
string m_email;
|
|
|
|
dbo::collection<TestContentTable> m_content;
|
|
|
|
public:
|
|
UserTable(const string& login,
|
|
const string& password,
|
|
const string& name,
|
|
const string& lastname,
|
|
const string& email);
|
|
|
|
inline string login() const noexcept {return this->m_login;}
|
|
inline string password() const noexcept {return this->m_password;}
|
|
inline string name() const noexcept {return this->m_name;}
|
|
inline string lastname() const noexcept {return this->m_lastname;}
|
|
inline string email() const noexcept {return this->m_email;}
|
|
inline void setPassword(const string& password) noexcept {this->m_password = password;}
|
|
inline void setName(const string& name) noexcept {this->m_name = name;}
|
|
inline void setLastname(const string& lastname) noexcept {this->m_lastname = lastname;}
|
|
inline void setEmail(const string& email) noexcept {this->m_email = email;}
|
|
|
|
|
|
template<class Action>
|
|
void persist(Action& a)
|
|
{
|
|
dbo::field(a, this->m_login, TB_USER_LOGIN);
|
|
dbo::field(a, this->m_password, TB_USER_PASSWORD);
|
|
dbo::field(a, this->m_name, TB_USER_NAME);
|
|
dbo::field(a, this->m_lastname, TB_USER_LASTNAME);
|
|
dbo::field(a, this->m_email, TB_USER_MAIL);
|
|
|
|
dbo::hasMany(a, this->m_content,dbo::ManyToMany,USER_TESTCONTENT_RELATION);
|
|
}
|
|
~UserTable();
|
|
};
|
|
|
|
#endif // USER_H
|