mirror of
https://github.com/Relintai/rcpp_framework.git
synced 2024-11-14 04:57:21 +01:00
46 lines
991 B
C++
46 lines
991 B
C++
#ifndef USER_MODEL_H
|
|
#define USER_MODEL_H
|
|
|
|
#include "core/string.h"
|
|
#include "core/containers/vector.h"
|
|
|
|
#include "core/object.h"
|
|
|
|
#include "user.h"
|
|
|
|
class UserModel : public Object {
|
|
RCPP_OBJECT(UserModel, Object);
|
|
|
|
public:
|
|
Ref<User> get_user(const int id);
|
|
Ref<User> get_user(const String &user_name_input);
|
|
void save_user(Ref<User> &user);
|
|
|
|
Vector<Ref<User> > get_all();
|
|
|
|
bool is_username_taken(const String &user_name_input);
|
|
bool is_email_taken(const String &email_input);
|
|
|
|
virtual bool check_password(const Ref<User> &user, const String &p_password);
|
|
virtual void create_password(Ref<User> &user, const String &p_password);
|
|
virtual String hash_password(const Ref<User> &user, const String &p_password);
|
|
|
|
virtual void create_table();
|
|
virtual void drop_table();
|
|
virtual void migrate();
|
|
|
|
static UserModel *get_singleton();
|
|
|
|
UserModel();
|
|
~UserModel();
|
|
|
|
protected:
|
|
static UserModel *_self;
|
|
|
|
String _file_path;
|
|
|
|
static String _path;
|
|
static String _table_name;
|
|
};
|
|
|
|
#endif |