rcpp_framework/modules/users/user_model.h

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