Older/WebApplication/model/BlogSession.h

35 lines
1.0 KiB
C
Raw Normal View History

2024-11-01 19:05:20 +08:00
#ifndef __BLOGSESSION_H__
#define __BLOGSESSION_H__
#include "BlogUserDatabase.h"
2024-11-02 00:30:14 +08:00
#include <Wt/Auth/Login.h>
#include <Wt/Auth/OAuthService.h>
2024-11-01 19:05:20 +08:00
#include <Wt/Dbo/Session.h>
#include <Wt/Dbo/backend/Sqlite3.h>
2024-11-02 00:30:14 +08:00
class Comment;
2024-11-01 19:05:20 +08:00
class BlogSession : public Wt::Dbo::Session {
public:
BlogSession(Wt::Dbo::SqlConnectionPool &connectionPool);
2024-11-02 00:30:14 +08:00
static void configureAuth();
2024-11-01 19:05:20 +08:00
static std::unique_ptr<Wt::Dbo::SqlConnectionPool> createConnectionPool(const std::string &sqlite3);
2024-11-02 00:30:14 +08:00
Wt::Auth::Login &login() {
return m_login;
}
Wt::Dbo::ptr<User> user() const;
2024-11-06 15:51:01 +08:00
Wt::Signal<Wt::Dbo::ptr<Comment>> &commentsChanged();
2024-11-02 00:30:14 +08:00
BlogUserDatabase &users() {
return m_users;
}
Wt::Auth::PasswordService *passwordAuth() const;
const std::vector<const Wt::Auth::OAuthService *> &oAuth() const;
2024-11-01 19:05:20 +08:00
private:
Wt::Dbo::SqlConnectionPool &m_connectionPool;
BlogUserDatabase m_users;
2024-11-02 00:30:14 +08:00
Wt::Auth::Login m_login;
2024-11-06 15:51:01 +08:00
Wt::Signal<Wt::Dbo::ptr<Comment>> m_commentsChanged;
2024-11-01 19:05:20 +08:00
};
#endif // __BLOGSESSION_H__