ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
party_repository Class Reference

Reads and writes parties to data storage. More...

#include <party_repository.hpp>

Collaboration diagram for party_repository:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 party_repository (context ctx)
 
std::string sql ()
 
void write (const domain::party &party)
 
void write (const std::vector< domain::party > &parties)
 
std::vector< domain::partyread_latest ()
 
std::vector< domain::partyread_latest (const boost::uuids::uuid &id)
 
std::vector< domain::partyread_latest_by_code (const std::string &code)
 
std::vector< domain::partyread_system_party (const std::string &tenant_id)
 Reads the system party for a given tenant.
 
std::vector< domain::partyread_latest (std::uint32_t offset, std::uint32_t limit)
 Reads latest parties with pagination support.
 
std::uint32_t get_total_party_count ()
 Gets the total count of active parties.
 
std::vector< boost::uuids::uuid > read_descendants (const boost::uuids::uuid &root_id)
 Reads all parties in the subtree rooted at the given party.
 
std::vector< domain::partyread_all (const boost::uuids::uuid &id)
 
void remove (const boost::uuids::uuid &id)
 

Detailed Description

Reads and writes parties to data storage.

Member Function Documentation

◆ read_system_party()

std::vector< domain::party > read_system_party ( const std::string &  tenant_id)

Reads the system party for a given tenant.

Every tenant has exactly one system party (party_category='system') which serves as the root of the party hierarchy.

Parameters
tenant_idThe tenant identifier
Returns
Vector containing the system party, or empty if not found

◆ read_latest()

std::vector< domain::party > read_latest ( std::uint32_t  offset,
std::uint32_t  limit 
)

Reads latest parties with pagination support.

Parameters
offsetNumber of records to skip
limitMaximum number of records to return
Returns
Vector of parties within the specified range

◆ get_total_party_count()

std::uint32_t get_total_party_count ( )

Gets the total count of active parties.

Returns
Total number of parties with valid_to == max_timestamp
Here is the caller graph for this function:

◆ read_descendants()

std::vector< boost::uuids::uuid > read_descendants ( const boost::uuids::uuid &  root_id)

Reads all parties in the subtree rooted at the given party.

Uses a recursive CTE to traverse the party hierarchy via parent_party_id. Returns the root party plus all its descendants (active records only).

Parameters
root_idThe party to start from (included in result)
Returns
UUIDs of root and all descendant parties