31 行
650 B
C++
31 行
650 B
C++
#pragma once
|
|
|
|
#include "csp/db/sqlite_db.h"
|
|
#include "csp/domain/entities.h"
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
namespace csp::services {
|
|
|
|
struct UserListResult {
|
|
std::vector<domain::GlobalLeaderboardEntry> items;
|
|
int total_count = 0;
|
|
};
|
|
|
|
class UserService {
|
|
public:
|
|
explicit UserService(db::SqliteDb& db) : db_(db) {}
|
|
|
|
std::optional<domain::User> GetById(int64_t id);
|
|
std::vector<domain::GlobalLeaderboardEntry> GlobalLeaderboard(int limit = 100);
|
|
UserListResult ListUsers(int page, int page_size);
|
|
void SetRating(int64_t user_id, int rating);
|
|
|
|
private:
|
|
db::SqliteDb& db_;
|
|
};
|
|
|
|
} // namespace csp::services
|