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

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

#include <tenant_repository.hpp>

Collaboration diagram for tenant_repository:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 tenant_repository (context ctx)
 
std::string sql ()
 Returns the SQL created by sqlgen to construct the table.
 
std::vector< domain::tenantread_latest ()
 Reads all latest active tenants.
 
std::vector< domain::tenantread_all_latest ()
 Reads the latest version of all tenants including deleted.
 
std::vector< domain::tenantread_latest (const boost::uuids::uuid &id)
 Reads a specific tenant by ID.
 
std::vector< domain::tenantread_latest_by_code (const std::string &code)
 Reads a specific tenant by code.
 
std::vector< domain::tenantread_latest_by_hostname (const std::string &hostname)
 Reads a specific tenant by hostname.
 
std::vector< domain::tenantread_history (const boost::uuids::uuid &id)
 Reads all historical versions of a tenant.
 
void remove (const boost::uuids::uuid &tenant_id)
 Deletes a tenant by closing its temporal validity.
 
void write (const domain::tenant &tenant)
 Writes a tenant to database.
 
void write (const std::vector< domain::tenant > &tenants)
 

Detailed Description

Reads and writes tenants to data storage.

Member Function Documentation

◆ read_latest()

std::vector< domain::tenant > read_latest ( )

Reads all latest active tenants.

Returns only tenants where valid_to = infinity (not deleted).

◆ read_all_latest()

std::vector< domain::tenant > read_all_latest ( )

Reads the latest version of all tenants including deleted.

Returns the most recent version of each tenant, regardless of whether it has been soft-deleted (valid_to != infinity).