44 行
1.4 KiB
C++
44 行
1.4 KiB
C++
#pragma once
|
|
|
|
#include "csp/db/sqlite_db.h"
|
|
#include "csp/domain/entities.h"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace csp::services {
|
|
|
|
struct WrongBookEntry {
|
|
domain::WrongBookItem item;
|
|
std::string problem_title;
|
|
};
|
|
|
|
class WrongBookService {
|
|
public:
|
|
explicit WrongBookService(db::SqliteDb& db) : db_(db) {}
|
|
|
|
std::vector<WrongBookEntry> ListByUser(int64_t user_id);
|
|
void UpsertNote(int64_t user_id, int64_t problem_id, const std::string& note);
|
|
std::string GetNote(int64_t user_id, int64_t problem_id);
|
|
std::string GetNoteImagesJson(int64_t user_id, int64_t problem_id);
|
|
void SetNoteImagesJson(int64_t user_id, int64_t problem_id, const std::string& note_images_json);
|
|
void UpsertNoteScore(int64_t user_id,
|
|
int64_t problem_id,
|
|
int32_t note_score,
|
|
int32_t note_rating,
|
|
const std::string& note_feedback_md);
|
|
int32_t GetNoteRating(int64_t user_id, int64_t problem_id);
|
|
void AwardNoteRating(int64_t user_id, int64_t problem_id, int delta);
|
|
void UpsertBySubmission(int64_t user_id,
|
|
int64_t problem_id,
|
|
int64_t submission_id,
|
|
const std::string& note);
|
|
void Remove(int64_t user_id, int64_t problem_id);
|
|
|
|
private:
|
|
db::SqliteDb& db_;
|
|
};
|
|
|
|
} // namespace csp::services
|