Entire Backend API with Postgres
Go to file
Benjamin Slingo e48015d946 Phase 3 foundation: establish sql:: module ecosystem for consistency
SQL MODULE INFRASTRUCTURE:
• Created 3 new sql:: modules: users, schedule, events
• Expanded existing sql:: module system to 8 total modules
• Updated sql/mod.rs with complete module organization
• Established consistent sql:: → direct SQL pattern

NEW SQL MODULES:
• src/sql/users.rs: User auth operations + UserWithPassword struct
• src/sql/schedule.rs: Schedule, offering, sunset SQL utilities
• src/sql/events.rs: Event lifecycle operations (enhanced from basic version)

PARTIAL SERVICE MIGRATIONS:
• AuthService: Successfully migrated to use sql::users (COMPLETE)
• EventService: Partial migration - 3/16 SQL queries moved to sql::events
• ScheduleService: Prepared sql::schedule module, migration pending

ARCHITECTURE FOUNDATION:
Before: Mixed patterns (some sql::, some direct SQL - inconsistent)
After:  Foundation for Handler → Service → sql:: → Direct SQL (consistent)

DISCOVERY: EventService complexity issue identified
- 16 SQL queries across V1/V2 APIs, pending events, pagination
- Violates single responsibility principle
- Needs refactoring: split into EventsV1Service, EventsV2Service, PendingEventsService

NEXT SESSION PLAN:
1. Restructure EventService into focused services (V1/V2/Pending separation)
2. Complete sql:: migrations with cleaner, smaller services
3. Achieve full Handler→Service→sql:: consistency across codebase

Benefits: Solid sql:: foundation established, AuthService fully migrated,
architectural pattern proven, cleaner refactoring path identified
2025-08-29 10:22:07 -04:00
migrations Add comprehensive hymnal support and enhance bulletin processing 2025-08-28 20:34:04 -04:00
src Phase 3 foundation: establish sql:: module ecosystem for consistency 2025-08-29 10:22:07 -04:00
tests Initial commit: Church API Rust implementation 2025-08-19 20:56:41 -04:00
.env.example Initial commit: Church API Rust implementation 2025-08-19 20:56:41 -04:00
.gitignore Add proper README and remove development documentation files 2025-08-19 21:01:55 -04:00
build.rs Initial commit: Church API Rust implementation 2025-08-19 20:56:41 -04:00
Cargo.toml Initial commit: Church API Rust implementation 2025-08-19 20:56:41 -04:00
cleanup_manual_hymn_titles.sql NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00
CLEANUP_PROGRESS.md Phase 3 foundation: establish sql:: module ecosystem for consistency 2025-08-29 10:22:07 -04:00
find_manual_hymn_titles.sql NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00
fix_timezone_double_conversion.sql NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00
HYMNARIUM_API_DOCUMENTATION.md NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00
LICENSE Initial commit: Church API Rust implementation 2025-08-19 20:56:41 -04:00
migrate_hymnal_data.py NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00
README.md Add proper README and remove development documentation files 2025-08-19 21:01:55 -04:00
simple_hymn_cleanup.sql NUCLEAR: Delete db_operations.rs entirely 2025-08-28 21:36:14 -04:00

Church API

A comprehensive church management system built with Rust and Axum, providing REST APIs for bulletin management, event scheduling, media processing, and live streaming integration.

Features

  • Bulletin Management: Upload, process, and serve church bulletins with automatic format conversion
  • Event Scheduling: Create and manage church events with recurring event support
  • Media Processing: Handle video uploads with transcoding and thumbnail generation
  • Live Streaming: Integration with Owncast for live stream management
  • User Authentication: JWT-based authentication with role-based access control
  • Email Notifications: SMTP integration for automated notifications
  • Database Management: PostgreSQL with automated migrations

Tech Stack

  • Backend: Rust with Axum web framework
  • Database: PostgreSQL with SQLx
  • Media Processing: GStreamer for video transcoding
  • Authentication: JWT with bcrypt password hashing
  • Email: lettre for SMTP integration

Quick Start

  1. Prerequisites

    • Rust 1.70+
    • PostgreSQL 13+
    • GStreamer development libraries
  2. Setup

    # Clone the repository
    git clone ssh://rockvilleav@git.rockvilletollandsda.church:10443/RTSDA/church-api.git
    cd church-api
    
    # Copy environment template
    cp .env.example .env
    # Edit .env with your configuration
    
    # Run database migrations
    sqlx migrate run
    
    # Build and run
    cargo run
    
  3. Configuration

    Edit .env with your settings:

    • Database URL
    • JWT secret
    • SMTP configuration
    • Upload directories

API Endpoints

  • POST /api/auth/login - User authentication
  • GET /api/bulletins - List bulletins
  • POST /api/bulletins - Upload bulletin
  • GET /api/events - List events
  • POST /api/events - Create event
  • POST /api/media/upload - Upload media files
  • GET /api/stream/status - Live stream status

Development

# Run tests
cargo test

# Check code
cargo check

# Format code
cargo fmt

License

MIT License - see LICENSE file for details.

Author

Benjamin Slingo