 2a2666e75f
			
		
	
	2a2666e75f
	
	
	
		
			
			Frontend Changes: - Add edit context menu option to EventContextMenu with pencil icon - Enhance CreateEventModal to support both create and edit modes - Add event data conversion methods for pre-populating edit forms - Implement conditional submit logic (on_create vs on_update callbacks) - Add update_event method to CalendarService with POST /calendar/events/update Backend Changes: - Add UpdateEventRequest and UpdateEventResponse models - Implement update_event handler with event search by UID across calendars - Add POST /api/calendar/events/update route - Full validation and parsing of all event properties for updates - Integrate with existing CalDAV client update_event functionality Users can now right-click events, select "Edit Event", modify properties in the modal, and successfully update existing events instead of creating duplicates. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			75 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use axum::{
 | |
|     response::Json,
 | |
|     routing::{get, post},
 | |
|     Router,
 | |
| };
 | |
| use tower_http::cors::{CorsLayer, Any};
 | |
| use std::sync::Arc;
 | |
| 
 | |
| mod auth;
 | |
| mod models;
 | |
| mod handlers;
 | |
| mod calendar;
 | |
| mod config;
 | |
| 
 | |
| use auth::AuthService;
 | |
| 
 | |
| #[derive(Clone)]
 | |
| pub struct AppState {
 | |
|     pub auth_service: AuthService,
 | |
| }
 | |
| 
 | |
| 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
 | |
|     let app = Router::new()
 | |
|         .route("/", get(root))
 | |
|         .route("/api/health", get(health_check))
 | |
|         .route("/api/auth/login", post(handlers::login))
 | |
|         .route("/api/auth/verify", get(handlers::verify_token))
 | |
|         .route("/api/user/info", get(handlers::get_user_info))
 | |
|         .route("/api/calendar/create", post(handlers::create_calendar))
 | |
|         .route("/api/calendar/delete", post(handlers::delete_calendar))
 | |
|         .route("/api/calendar/events", get(handlers::get_calendar_events))
 | |
|         .route("/api/calendar/events/create", post(handlers::create_event))
 | |
|         .route("/api/calendar/events/update", post(handlers::update_event))
 | |
|         .route("/api/calendar/events/delete", post(handlers::delete_event))
 | |
|         .route("/api/calendar/events/:uid", get(handlers::refresh_event))
 | |
|         .layer(
 | |
|             CorsLayer::new()
 | |
|                 .allow_origin(Any)
 | |
|                 .allow_methods(Any)
 | |
|                 .allow_headers(Any),
 | |
|         )
 | |
|         .with_state(Arc::new(app_state));
 | |
| 
 | |
|     // 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(())
 | |
| }
 | |
| 
 | |
| async fn root() -> &'static str {
 | |
|     "Calendar Backend API v0.1.0"
 | |
| }
 | |
| 
 | |
| async fn health_check() -> Json<serde_json::Value> {
 | |
|     Json(serde_json::json!({
 | |
|         "status": "healthy",
 | |
|         "service": "calendar-backend",
 | |
|         "version": "0.1.0"
 | |
|     }))
 | |
| } |