forked from mtusi2026/mtusi2026lab5
lab5
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "db.hpp"
|
||||
#include "models.hpp"
|
||||
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class AttachmentRepo {
|
||||
public:
|
||||
explicit AttachmentRepo(PgPool& pool) : pool_(pool) {}
|
||||
|
||||
Attachment insert(const Attachment& a);
|
||||
Attachment insert_queued(const Attachment& a, const std::string& job_id,
|
||||
const std::function<void()>& save_original);
|
||||
|
||||
std::optional<Attachment> find_by_id(const std::string& id);
|
||||
|
||||
// All IDs must exist, belong to chat_id, and not have status=failed.
|
||||
// Returns false if any id is missing/foreign/failed.
|
||||
bool all_belong_to_chat(const std::string& chat_id,
|
||||
const std::vector<std::string>& ids);
|
||||
|
||||
private:
|
||||
PgPool& pool_;
|
||||
};
|
||||
Reference in New Issue
Block a user