20#ifndef ORES_REFDATA_CORE_SERVICE_CURRENCY_SERVICE_HPP
21#define ORES_REFDATA_CORE_SERVICE_CURRENCY_SERVICE_HPP
27#include <boost/uuid/uuid.hpp>
28#include "ores.database/domain/context.hpp"
29#include "ores.refdata.api/domain/currency.hpp"
30#include "ores.refdata.api/domain/currency_version_history.hpp"
31#include "ores.refdata.core/repository/currency_repository.hpp"
32#include "ores.refdata.core/repository/party_currency_repository.hpp"
33#include "ores.logging/make_logger.hpp"
35namespace ores::refdata::service {
45 inline static std::string_view logger_name =
46 "ores.refdata.service.currency_service";
48 [[nodiscard]]
static auto& lg() {
50 static auto instance = make_logger(logger_name);
116 std::optional<domain::currency>
get_currency(
const std::string& iso_code);
136 std::optional<domain::currency_version_history>
151 const boost::uuids::uuid& party_id,
152 std::uint32_t offset, std::uint32_t limit);
165 repository::party_currency_repository junction_repo_;
Implements logging infrastructure for ORE Studio.
Definition boost_severity.hpp:28
Context for the operations on a postgres database.
Definition context.hpp:47
Represents a currency with its metadata and formatting rules.
Definition currency.hpp:34
Reads and writes currencies off of data storage.
Definition currency_repository.hpp:35
Service for managing currencies.
Definition currency_service.hpp:43
void delete_currency(const std::string &iso_code)
Deletes a currency by its ISO code.
Definition currency_service.cpp:74
std::uint32_t count_currencies_for_party(const boost::uuids::uuid &party_id)
Gets the total count of currencies visible to a specific party.
Definition currency_service.cpp:169
std::vector< domain::currency > list_currencies(std::uint32_t offset, std::uint32_t limit)
Lists currencies with pagination support.
Definition currency_service.cpp:39
std::vector< domain::currency > get_currency_history(const std::string &iso_code)
Retrieves all historical versions of a currency.
Definition currency_service.cpp:94
std::optional< domain::currency_version_history > get_currency_version_history(const std::string &iso_code)
Retrieves currency version history with version metadata.
Definition currency_service.cpp:101
void delete_currencies(const std::vector< std::string > &iso_codes)
Deletes currencies by their ISO codes.
Definition currency_service.cpp:79
std::uint32_t count_currencies()
Gets the total count of active currencies.
Definition currency_service.cpp:46
void save_currencies(const std::vector< domain::currency > ¤cies)
Saves a batch of currencies atomically (all or nothing).
Definition currency_service.cpp:61
std::vector< domain::currency > list_currencies_for_party(const boost::uuids::uuid &party_id, std::uint32_t offset, std::uint32_t limit)
Lists currencies visible to a specific party, with pagination.
Definition currency_service.cpp:139
void save_currency(const domain::currency ¤cy)
Saves a currency (creates or updates).
Definition currency_service.cpp:51
std::optional< domain::currency > get_currency(const std::string &iso_code)
Retrieves a single currency by its ISO code.
Definition currency_service.cpp:84