PACS System 0.1.0
PACS DICOM system library
Loading...
Searching...
No Matches
viewer_state_record_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
18#pragma once
19
22
23#ifdef PACS_WITH_DATABASE_SYSTEM
24
25namespace kcenon::pacs::storage {
26
56class viewer_state_record_repository
57 : public base_repository<viewer_state_record, std::string> {
58public:
64 explicit viewer_state_record_repository(
65 std::shared_ptr<pacs_database_adapter> db);
66
67 // =========================================================================
68 // Domain-Specific Queries
69 // =========================================================================
70
77 [[nodiscard]] auto find_by_study(std::string_view study_uid)
78 -> list_result_type;
79
86 [[nodiscard]] auto find_by_user(std::string_view user_id)
87 -> list_result_type;
88
96 [[nodiscard]] auto find_by_study_and_user(
97 std::string_view study_uid,
98 std::string_view user_id) -> list_result_type;
99
106 [[nodiscard]] auto search(const viewer_state_query& query)
107 -> list_result_type;
108
109protected:
110 // =========================================================================
111 // base_repository Overrides
112 // =========================================================================
113
117 [[nodiscard]] auto map_row_to_entity(const database_row& row) const
118 -> viewer_state_record override;
119
123 [[nodiscard]] auto entity_to_row(const viewer_state_record& entity) const
124 -> std::map<std::string, database_value> override;
125
129 [[nodiscard]] auto get_pk(const viewer_state_record& entity) const
130 -> std::string override;
131
135 [[nodiscard]] auto has_pk(const viewer_state_record& entity) const
136 -> bool override;
137
141 [[nodiscard]] auto select_columns() const
142 -> std::vector<std::string> override;
143
144private:
148 [[nodiscard]] auto parse_timestamp(const std::string& str) const
149 -> std::chrono::system_clock::time_point;
150
154 [[nodiscard]] auto format_timestamp(
155 std::chrono::system_clock::time_point tp) const -> std::string;
156};
157
158} // namespace kcenon::pacs::storage
159
160#endif // PACS_WITH_DATABASE_SYSTEM
Generic base repository for CRUD operations.
Viewer state record data structures for database operations.