Files
Jon Staab c9c1dd2c4c
Docker / build-and-push-image (backend, backend, coracle/caravel-backend) (push) Failing after 4m45s
Docker / build-and-push-image (frontend, frontend, coracle/caravel-frontend) (push) Successful in 2m45s
Group subscription items by price
2026-05-12 15:53:17 -07:00

1.2 KiB

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<Vec<Tenant>>

  • Returns all tenants

pub fn get_tenant(&self, pubkey: &str) -> Result<Tenant>

  • Returns matching tenant

pub fn list_plans() -> Vec<Plan>

  • 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<Vec<Relay>>

  • Returns all relays

pub fn list_relays_for_tenant(&self, tenant_id: &str) -> Result<Vec<Relay>>

  • Returns all relays belonging to the given tenant

pub fn get_relay(&self, id: &str) -> Result<Relay>

  • Returns matching relay

pub fn get_tenant_by_stripe_customer_id(&self, stripe_customer_id: &str) -> Result<Tenant>

  • Returns the tenant matching the given stripe_customer_id

pub fn list_activity_for_relay(&self, relay_id: &str) -> Result<Vec<Activity>>

  • Returns all activity where resource_type = 'relay' and resource_id = relay_id
  • Ordered newest-first