Fix calendar event fetching to use visible date range
Some checks failed
Build and Push Docker Image / docker (push) Failing after 1m7s
Some checks failed
Build and Push Docker Image / docker (push) Failing after 1m7s
Moved event fetching logic from CalendarView to Calendar component to properly use the visible date range instead of hardcoded current month. The Calendar component already tracks the current visible date through navigation, so events now load correctly for August and other months when navigating. Changes: - Calendar component now manages its own events state and fetching - Event fetching responds to current_date changes from navigation - CalendarView simplified to just render Calendar component - Fixed cargo fmt/clippy formatting across codebase 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -3,14 +3,14 @@ use axum::{
|
||||
routing::{get, post},
|
||||
Router,
|
||||
};
|
||||
use tower_http::cors::{CorsLayer, Any};
|
||||
use std::sync::Arc;
|
||||
use tower_http::cors::{Any, CorsLayer};
|
||||
|
||||
pub mod auth;
|
||||
pub mod models;
|
||||
pub mod handlers;
|
||||
pub mod calendar;
|
||||
pub mod config;
|
||||
pub mod handlers;
|
||||
pub mod models;
|
||||
|
||||
use auth::AuthService;
|
||||
|
||||
@@ -22,13 +22,13 @@ pub struct AppState {
|
||||
pub async fn run_server() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Initialize logging
|
||||
println!("🚀 Starting Calendar Backend Server");
|
||||
|
||||
|
||||
// Create auth service
|
||||
let jwt_secret = std::env::var("JWT_SECRET")
|
||||
.unwrap_or_else(|_| "your-super-secret-jwt-key-change-in-production".to_string());
|
||||
|
||||
|
||||
let auth_service = AuthService::new(jwt_secret);
|
||||
|
||||
|
||||
let app_state = AppState { auth_service };
|
||||
|
||||
// Build our application with routes
|
||||
@@ -46,9 +46,18 @@ pub async fn run_server() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.route("/api/calendar/events/delete", post(handlers::delete_event))
|
||||
.route("/api/calendar/events/:uid", get(handlers::refresh_event))
|
||||
// Event series-specific endpoints
|
||||
.route("/api/calendar/events/series/create", post(handlers::create_event_series))
|
||||
.route("/api/calendar/events/series/update", post(handlers::update_event_series))
|
||||
.route("/api/calendar/events/series/delete", post(handlers::delete_event_series))
|
||||
.route(
|
||||
"/api/calendar/events/series/create",
|
||||
post(handlers::create_event_series),
|
||||
)
|
||||
.route(
|
||||
"/api/calendar/events/series/update",
|
||||
post(handlers::update_event_series),
|
||||
)
|
||||
.route(
|
||||
"/api/calendar/events/series/delete",
|
||||
post(handlers::delete_event_series),
|
||||
)
|
||||
.layer(
|
||||
CorsLayer::new()
|
||||
.allow_origin(Any)
|
||||
@@ -60,7 +69,7 @@ pub async fn run_server() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Start server
|
||||
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
||||
println!("📡 Server listening on http://0.0.0.0:3000");
|
||||
|
||||
|
||||
axum::serve(listener, app).await?;
|
||||
|
||||
Ok(())
|
||||
@@ -76,4 +85,4 @@ async fn health_check() -> Json<serde_json::Value> {
|
||||
"service": "calendar-backend",
|
||||
"version": "0.1.0"
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user