PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
sync_config_repository.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2021-2025, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
15#pragma once
16
19
20#ifdef PACS_WITH_DATABASE_SYSTEM
21
22namespace kcenon::pacs::storage {
23
30class sync_config_repository
31 : public base_repository<client::sync_config, std::string> {
32public:
33 explicit sync_config_repository(std::shared_ptr<pacs_database_adapter> db);
34
35 // =========================================================================
36 // Domain-Specific Queries
37 // =========================================================================
38
42 [[nodiscard]] auto find_by_config_id(std::string_view config_id)
43 -> result_type;
44
48 [[nodiscard]] auto find_enabled() -> list_result_type;
49
53 [[nodiscard]] auto find_by_source_node(std::string_view node_id)
54 -> list_result_type;
55
59 [[nodiscard]] auto update_stats(
60 std::string_view config_id,
61 bool success,
62 size_t studies_synced) -> VoidResult;
63
64protected:
65 [[nodiscard]] auto map_row_to_entity(const database_row& row) const
66 -> client::sync_config override;
67
68 [[nodiscard]] auto entity_to_row(const client::sync_config& entity) const
69 -> std::map<std::string, database_value> override;
70
71 [[nodiscard]] auto get_pk(const client::sync_config& entity) const
72 -> std::string override;
73
74 [[nodiscard]] auto has_pk(const client::sync_config& entity) const
75 -> bool override;
76
77 [[nodiscard]] auto select_columns() const
78 -> std::vector<std::string> override;
79
80private:
81 [[nodiscard]] auto parse_timestamp(const std::string& str) const
82 -> std::chrono::system_clock::time_point;
83
84 [[nodiscard]] auto format_timestamp(
85 std::chrono::system_clock::time_point tp) const -> std::string;
86
87 [[nodiscard]] static auto serialize_vector(
88 const std::vector<std::string>& vec) -> std::string;
89
90 [[nodiscard]] static auto deserialize_vector(
91 std::string_view json) -> std::vector<std::string>;
92};
93
94} // namespace kcenon::pacs::storage
95
96#endif // PACS_WITH_DATABASE_SYSTEM
Generic base repository for CRUD operations.
Types and structures for bidirectional DICOM synchronization.