DuxReiNummariae 1.0.0-alpha.23
Simple and powerful budgeting application
 
Loading...
Searching...
No Matches
drn::surveying::CompletedSurveys Class Referencefinal

Represents a collection of completed surveys identified by a bank account. It provides extended functionality built upon a map-like structure for efficient access and modification of surveys. More...

#include <CompletedSurvey.h>

Inheritance diagram for drn::surveying::CompletedSurveys:
Collaboration diagram for drn::surveying::CompletedSurveys:

Public Member Functions

 CompletedSurveys (std::map< banking::BankAccount, CompletedSurvey > surveys)
 Constructs a collection of completed surveys associated with bank accounts.
 
std::optional< CompletedSurveylookUpSurvey (const banking::BankAccount &ba) const noexcept
 Looks up a completed survey for a given bank account. This query provides information regarding the survey associated with the reconciled state of the bank account, aiding in identifying its distribution and budgeting details.
 
std::optional< CompletedSurveylookUpSurvey (const banking::BankName &bn, const accounting::AccountNumber &an) const noexcept
 Searches for a completed survey linked to a specific bank and account. This is used to retrieve a previously reconciled survey for a bank account, enabling review or further processing of the completed survey data.
 
bool upsert (CompletedSurvey survey)
 Inserts or updates a completed survey for a specific bank account, ensuring distribution identifiers are unique within the context of all existing surveys.
 

Detailed Description

Represents a collection of completed surveys identified by a bank account. It provides extended functionality built upon a map-like structure for efficient access and modification of surveys.

Constructor & Destructor Documentation

◆ CompletedSurveys()

drn::surveying::CompletedSurveys::CompletedSurveys ( std::map< banking::BankAccount, CompletedSurvey > surveys)
explicit

Constructs a collection of completed surveys associated with bank accounts.

Exceptions
SurveyErrorThrown when an indexed bank account does not match the surveyed bank account.
Parameters
surveysA collection mapping bank accounts to their completed surveys.

Member Function Documentation

◆ lookUpSurvey() [1/2]

std::optional< CompletedSurvey > drn::surveying::CompletedSurveys::lookUpSurvey ( const banking::BankAccount & ba) const
nodiscardnoexcept

Looks up a completed survey for a given bank account. This query provides information regarding the survey associated with the reconciled state of the bank account, aiding in identifying its distribution and budgeting details.

Parameters
baThe bank account for which the completed survey is being looked up.
Returns
An optional object containing the completed survey for the given bank account, or an empty result if no associated survey is found.

◆ lookUpSurvey() [2/2]

std::optional< CompletedSurvey > drn::surveying::CompletedSurveys::lookUpSurvey ( const banking::BankName & bn,
const accounting::AccountNumber & an ) const
nodiscardnoexcept

Searches for a completed survey linked to a specific bank and account. This is used to retrieve a previously reconciled survey for a bank account, enabling review or further processing of the completed survey data.

Parameters
bnThe name of the bank associated with the survey being searched.
anThe number of the account associated with the survey being searched.
Returns
An optional containing the completed survey if a match is found, or an empty result if no matching survey exists.

◆ upsert()

bool drn::surveying::CompletedSurveys::upsert ( CompletedSurvey survey)

Inserts or updates a completed survey for a specific bank account, ensuring distribution identifiers are unique within the context of all existing surveys.

Exceptions
SurveyErrorWhen the provided survey contains a distribution identifier that overlaps with an existing survey’s identifiers for a different bank account.
Parameters
surveyThe completed survey to insert or update. This survey includes reconciled data, distributions, and other associated information.
Postcondition
If the bank account associated with the provided survey does not exist within the system, the survey is added as a new entry. If the bank account does exist, the existing survey is replaced with the provided survey.
Returns
Returns true if a new survey is inserted, and false if an existing survey is replaced.