//! # Storage Module //! //! Database operations and data models using PostgreSQL with SQLx for type-safe queries. //! //! This module provides a comprehensive data layer for the smokesignal application, handling all //! database interactions, caching, and data modeling. It uses SQLx for compile-time verified SQL //! queries and PostgreSQL for reliable, ACID-compliant data storage. //! //! ## Architecture //! //! The storage layer is organized around several key data domains: //! //! ### Core Data Models //! - **[`event`]** - Event creation, modification, and querying //! - **[`handle`]** - User handle management and DID resolution //! - **[`oauth`]** - OAuth session and token management //! - **[`cache`]** - Redis-based caching for performance optimization //! //! ### Support Systems //! - **[`denylist`]** - Content moderation and spam prevention //! - **[`types`]** - Common data types and structures //! - **[`errors`]** - Storage-specific error handling //! //! ## Features //! //! ### Type-Safe Queries //! All database queries are verified at compile time using SQLx: //! - Compile-time SQL validation //! - Automatic Rust type mapping //! - Protection against SQL injection //! - Schema migration support //! //! ### Performance Optimization //! - Redis caching for frequently accessed data //! - Connection pooling for database efficiency //! - Prepared statement reuse //! - Efficient pagination for large datasets //! //! ### Data Integrity //! - ACID transactions for complex operations //! - Foreign key constraints //! - Data validation at the storage layer //! - Consistent error handling //! //! ## Database Schema //! //! The application uses PostgreSQL with the following main tables: //! - `events` - Event data and metadata //! - `rsvps` - User responses to events //! - `handles` - User identity and DID mapping //! - `oauth_sessions` - Authentication session data //! - `denylist` - Moderation and filtering data //! //! ## Example Usage //! //! ```rust,no_run //! use smokesignal::storage::event::EventStorage; //! use sqlx::PgPool; //! //! async fn create_event_example(pool: &PgPool) -> anyhow::Result<()> { //! let event_storage = EventStorage::new(pool); //! //! // Create a new event //! let event = event_storage.create_event( //! "Community Meetup", //! "A friendly local gathering", //! "organizer.did", //! ).await?; //! //! println!("Created event: {}", event.name); //! Ok(()) //! } //! ``` pub mod cache; pub mod denylist; pub mod errors; pub mod event; pub mod handle; pub mod oauth; pub mod types; pub use types::*;