/
Shymer123
/
LumenServer
Обзор
Документация
Войти
/
Shymer123
/
LumenServer
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
Server/SourceFiles/Services/AuthService.h
45 строк
2 KB
Shymer123
Initial commit: LumenServer
20 июн 2026, 12:43
20 июн 2026, 12:43
173f14c
Код
Авторство
О чём код?
#ifndef AUTHSERVICE_H #define AUTHSERVICE_H #include <string> #include "Storage/Db/Repositories/AuthRepository.h" #include "TokenService.h" #include "Data/Models/UserBasicInfo.h" namespace Services { class AuthService { public: struct AuthResult { Tokens tokens; std::string user_id; }; public: explicit AuthService(Storage::Db::Repositories::AuthRepository& authRepo, TokenService& tokenService); std::optional<std::string> getAuthData(const std::string& phone); std::optional<AuthResult> login(const std::string& phone, const std::string& password, const std::string& deviceId = ""); std::optional<AuthResult> registerUser(const std::string& display_name, const std::string& password, const std::string& salt, const std::string& phone, const std::string& deviceId = ""); std::optional<AuthResult> autoLogin(const std::string& refreshToken, const std::string& deviceId); std::vector<Storage::Db::Repositories::SessionRecord> getUserSessions(const std::string& userId); bool logoutDevice(const std::string& userId, const std::string& deviceId); bool isUserExist(const std::string& userId); std::optional<std::tuple<std::string, std::string, std::string>> getUserData(const std::string& userId); std::optional<Data::Models::UserBasicInfo> getUserByPhone(const std::string& phone); private: Storage::Db::Repositories::AuthRepository& m_authRepo; TokenService& m_tokenService; }; } // namespace Services #endif // AUTHSERVICE_H