# `pub struct Query` Query reads from the database. Members: - `pool: SqlitePool` - a sqlite connection pool ## `pub fn new(&self, pool: SqlitePool) -> Self` - Assigns pool to self ## `pub fn list_tenants(&self) -> Result>` - Returns all tenants ## `pub fn get_tenant(&self, pubkey: &str) -> Result` - Returns matching tenant ## `pub fn list_plans() -> Vec` - Returns the hardcoded relay plans used by the system (`free`, `basic`, `growth`) - This is the source of truth for plan metadata exposed via API ## `pub fn list_relays(&self) -> Result>` - Returns all relays ## `pub fn list_relays_for_tenant(&self, tenant_id: &str) -> Result>` - Returns all relays belonging to the given tenant ## `pub fn get_relay(&self, id: &str) -> Result` - Returns matching relay ## `pub fn get_tenant_by_stripe_customer_id(&self, stripe_customer_id: &str) -> Result` - Returns the tenant matching the given `stripe_customer_id` ## `pub fn has_active_paid_relays(&self, tenant_id: &str) -> Result` - Returns true if the tenant has any relays where `status = 'active'` and `plan != 'free'` ## `pub fn list_activity_for_relay(&self, relay_id: &str) -> Result>` - Returns all activity where `resource_type = 'relay'` and `resource_id = relay_id` - Ordered newest-first