FOSSredder 0.5.0
Loading...
Searching...
No Matches
WorkspaceCommandService.h
Go to the documentation of this file.
1
5
6#pragma once
7
8#include <string>
9#include <vector>
10
19
20namespace core::application {
21
23
24struct ActorInput {
25 std::string name;
26 std::vector<core::domain::Alias> aliases;
27 std::vector<std::string> contractIds;
28};
29
31 std::string name;
32 std::vector<core::domain::Alias> aliases;
33 std::vector<std::string> contractIds;
34};
35
37 std::string name;
38 std::string type;
39 std::string allocatableMode = "mixed";
40 std::vector<std::string> actorIds;
41 std::vector<std::string> propertyIds;
42 std::vector<core::domain::Alias> aliases;
43};
44
58
69
71public:
75
80
82 [[nodiscard]] std::string addActor(const core::ports::workspace::ActorCommand& command);
84 void updateActor(const core::ports::workspace::ActorCommand& command);
86 void deleteActor(const std::string& id);
87
89 [[nodiscard]] std::string addProperty(const core::ports::workspace::PropertyCommand& command);
91 void updateProperty(const core::ports::workspace::PropertyCommand& command);
93 void deleteProperty(const std::string& id);
94
96 [[nodiscard]] std::string addContract(const core::ports::workspace::ContractCommand& command);
98 void updateContract(const core::ports::workspace::ContractCommand& command);
100 void deleteContract(const std::string& id);
101
103 [[nodiscard]] std::string addStatement(const core::ports::workspace::StatementCommand& command);
105 [[nodiscard]] std::string addStatementWithTransactions(const core::ports::workspace::StatementWithTransactionsCommand& command);
107 void updateStatement(const core::ports::workspace::StatementCommand& command);
109 void deleteStatement(const std::string& id);
110
112 [[nodiscard]] std::string addTransaction(const core::ports::workspace::TransactionCommand& command);
114 void updateTransaction(const core::ports::workspace::TransactionCommand& command);
116 void deleteTransaction(const std::string& id);
117
119 [[nodiscard]] std::string addAnalysis(const core::ports::workspace::AnalysisCommand& command);
121 void updateAnalysis(const core::ports::workspace::AnalysisCommand& command);
123 void deleteAnalysis(const std::string& id);
124
126 [[nodiscard]] std::string addAnnual(const core::ports::workspace::AnnualCommand& command);
128 void updateAnnual(const core::ports::workspace::AnnualCommand& command);
130 void deleteAnnual(const std::string& id);
131
133 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::ActorCommand& command) const;
135 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::PropertyCommand& command) const;
137 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::ContractCommand& command) const;
139 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::StatementCommand& command) const;
141 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::TransactionCommand& command) const;
143 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::StatementWithTransactionsCommand& command) const;
145 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::AnalysisCommand& command) const;
147 [[nodiscard]] core::ports::workspace::ValidationResult validate(const core::ports::workspace::AnnualCommand& command) const;
148
149private:
150 static std::string commitCreated(WorkspaceCommandService& service, std::string id);
151 static void commitIfChanged(WorkspaceCommandService& service, bool changed);
152
153 core::domain::catalog::WorkspaceCatalog& mutableCatalogState() noexcept;
154 const core::domain::catalog::WorkspaceCatalog& catalogState() const noexcept;
155 void commit();
156 void notifyCatalogChanged();
157
158 WorkspaceSession* session_ = nullptr;
159};
160
161} // namespace core::application
Domain model for entity aliases.
Value object for analysis type labels.
Value object for normalized booking dates.
Value object for export format labels.
Value object for analysis filter specifications.
Domain model for transactions.
Domain aggregate that stores catalog entities for one workspace.
WorkspaceCommandService & operator=(const WorkspaceCommandService &)=delete
void deleteAnalysis(const std::string &id)
Deletes analysis by id.
void updateTransaction(const core::ports::workspace::TransactionCommand &command)
Updates transaction identified by command id.
void updateStatement(const core::ports::workspace::StatementCommand &command)
Updates statement identified by command id.
WorkspaceCommandService(WorkspaceCommandService &&) noexcept
WorkspaceCommandService(const WorkspaceCommandService &)=delete
WorkspaceCommandService(WorkspaceSession &session)
Creates command service bound to one workspace session.
std::string addTransaction(const core::ports::workspace::TransactionCommand &command)
Adds transaction and returns created id.
void updateContract(const core::ports::workspace::ContractCommand &command)
Updates contract identified by command id.
void updateActor(const core::ports::workspace::ActorCommand &command)
Updates actor identified by command id.
core::ports::workspace::ValidationResult validate(const core::ports::workspace::ActorCommand &command) const
Validates actor command data without mutating state.
void deleteAnnual(const std::string &id)
Deletes annual aggregate by id.
std::string addStatementWithTransactions(const core::ports::workspace::StatementWithTransactionsCommand &command)
Adds statement and transactions in one workspace mutation.
void deleteContract(const std::string &id)
Deletes contract by id.
void deleteProperty(const std::string &id)
Deletes property by id.
void deleteStatement(const std::string &id)
Deletes statement by id.
void deleteTransaction(const std::string &id)
Deletes transaction by id.
std::string addActor(const core::ports::workspace::ActorCommand &command)
Adds actor and returns created id.
std::string addAnnual(const core::ports::workspace::AnnualCommand &command)
Adds annual aggregate and returns created id.
void deleteActor(const std::string &id)
Deletes actor by id.
std::string addContract(const core::ports::workspace::ContractCommand &command)
Adds contract and returns created id.
void updateAnnual(const core::ports::workspace::AnnualCommand &command)
Updates annual aggregate identified by command id.
std::string addProperty(const core::ports::workspace::PropertyCommand &command)
Adds property and returns created id.
void updateAnalysis(const core::ports::workspace::AnalysisCommand &command)
Updates analysis identified by command id.
std::string addAnalysis(const core::ports::workspace::AnalysisCommand &command)
Adds analysis and returns created id.
std::string addStatement(const core::ports::workspace::StatementCommand &command)
Adds statement and returns created id.
void updateProperty(const core::ports::workspace::PropertyCommand &command)
Updates property identified by command id.
Maintains the editable app state for one workspace and persists it through IStorageManager.
Write-side boundary command models for workspace operations.
std::vector< core::domain::Alias > aliases
std::vector< std::string > contractIds
core::ports::analysis::AnalysisConfigInput config
core::ports::analysis::AnalysisFilterSelection filter
core::domain::ExportFormat exportFormat
std::vector< std::pair< std::string, double > > adjustments
std::vector< core::ports::workspace::TransactionSnapshot > snapshotTransactions
std::vector< core::domain::Alias > aliases
std::vector< std::string > propertyIds
std::vector< std::string > contractIds
std::vector< core::domain::Alias > aliases
core::domain::Transaction::Status status