Older/WebApplication/model/BlogSession.h
amass b6e0681489
All checks were successful
Deploy / PullDocker (push) Successful in 4s
Deploy / Build (push) Successful in 2m8s
Deploy Docker Images / Docusaurus build and Server deploy (push) Successful in 13s
add code.
2024-11-02 00:30:14 +08:00

37 lines
1.0 KiB
C++

#ifndef __BLOGSESSION_H__
#define __BLOGSESSION_H__
#include "BlogUserDatabase.h"
#include <Wt/Auth/Login.h>
#include <Wt/Auth/OAuthService.h>
#include <Wt/Dbo/Session.h>
#include <Wt/Dbo/backend/Sqlite3.h>
class Comment;
class BlogSession : public Wt::Dbo::Session {
public:
BlogSession(Wt::Dbo::SqlConnectionPool &connectionPool);
static void configureAuth();
static std::unique_ptr<Wt::Dbo::SqlConnectionPool> createConnectionPool(const std::string &sqlite3);
Wt::Auth::Login &login() {
return m_login;
}
Wt::Dbo::ptr<User> user() const;
Wt::Signal<Wt::Dbo::ptr<Comment>> &commentsChanged() {
return commentsChanged_;
}
BlogUserDatabase &users() {
return m_users;
}
Wt::Auth::PasswordService *passwordAuth() const;
const std::vector<const Wt::Auth::OAuthService *> &oAuth() const;
private:
Wt::Dbo::SqlConnectionPool &m_connectionPool;
BlogUserDatabase m_users;
Wt::Auth::Login m_login;
Wt::Signal<Wt::Dbo::ptr<Comment>> commentsChanged_;
};
#endif // __BLOGSESSION_H__