
Streamline admin panel to only handle pending event approvals: - Remove create_admin_event functions from Rust core - Remove createAdminEventJson from API bindings - Update events admin page to focus on pending approvals only - Maintain edit/delete for approved events via main collection Enforces cleaner workflow: Submit → Approve → Auto-move to events collection
3.7 KiB
3.7 KiB
CLAUDE INSTRUCTIONS - RTSDA CODEBASE
CRITICAL ARCHITECTURE UNDERSTANDING
ASTRO IS A THIN UI LAYER ONLY
- Astro handles routing, SSR, and basic UI rendering
- NO BUSINESS LOGIC IN FRONTEND
- NO DIRECT API CALLS FROM FRONTEND
- ALL LOGIC GOES THROUGH
church-core
RUST CRATE
THE RUST CRATE IS THE CORE FOR A FUCKING REASON
church-core/
contains ALL business logicchurch-core/
handles ALL API communicationchurch-core/
provides unified data modelschurch-core/
has caching, error handling, auth- USE THE RUST CRATE, DON'T BYPASS IT
✅ FIXED VIOLATIONS
Admin Panel (COMPLETED ✅)
REMOVEDpublic/admin/scripts/main.js
- 1800+ lines of vanilla JS- ✅ NOW: Proper Astro routes using Rust functions via FFI bindings
- ✅ FIXED: Frontend now follows core architecture
REMAINING VIOLATIONS TO FIX
Event Submission Direct API Call
src/pages/events/submit.astro:748
- Still uses direct fetch() call- SHOULD BE: Use
submitEventJson()
from bindings.js - VIOLATION: Bypassing the unified client architecture
Data Model Mismatches
- Frontend expects detailed Schedule fields (
song_leader
,childrens_story
) - Backend Rust models missing these fields
- CAUSE: Frontend developed independently of core models
CORRECT ARCHITECTURE FLOW
Frontend (Astro) → bindings.js → Rust FFI → church-core → API
NOT:
Frontend → fetch() → API directly
HOW TO FIX VIOLATIONS
For Event Submission:
- ✅ Admin functions already exist in
church-core/src/client/admin.rs
- ✅ Already exposed via FFI in
church-core/src/api.rs
- ✅ Already imported in
astro-church-website/src/lib/bindings.js
- TODO: Replace
fetch()
call withsubmitEventJson()
function
For Data Models:
- Update Schedule models in
church-core/src/models/admin.rs
- Add missing fields (
song_leader
,childrens_story
, etc.) - Regenerate FFI bindings
- Update frontend to use new model structure
COMMANDS TO REMEMBER
Build Commands:
# Build Rust bindings FIRST
npm run build:native
# Then build Astro
npm run build
# Dev server
npm run dev
Testing Commands:
# Test Rust core
cd church-core && cargo test
# Test API connectivity
cd church-core && cargo run --bin church-core-test
BEFORE MAKING CHANGES
- Check if Rust function exists in
church-core/
- If missing, ADD IT TO RUST FIRST
- Then expose via FFI bindings
- Finally update frontend to use it
DO NOT:
- Add business logic to JavaScript
- Make direct API calls from frontend
- Create data models in frontend
- Bypass the Rust crate architecture
THE RUST CRATE EXISTS FOR:
- Cross-platform consistency (iOS, Android, Web)
- Type safety and error handling
- Unified caching and auth
- Single source of truth for API communication
RESPECT THE ARCHITECTURE. USE THE RUST CRATE.
CLEANUP PROGRESS TRACKING
✅ COMPLETED (Aug 29, 2025)
- Admin Panel Conversion: Removed 1843-line vanilla JS file
- Proper Astro Routes: Created TypeScript admin routes using Rust functions
- Thumbnail Field Removal: Cleaned up event submission form
- FFI Functions: Added 12 new admin functions in church-core
- Architecture Compliance: Admin panel now follows correct flow
Commit: f91f696
- Convert admin panel to Astro routes and remove thumbnail field
🚨 HIGH PRIORITY NEXT
- Fix event submission direct API call (
src/pages/events/submit.astro:748
) - Check Schedule model data field mismatches
- Add missing admin functions (stats, config, users)
See: /NEXT-STEPS.md
for detailed implementation plan