# Fix the approve handler with email
sed -i '/pub async fn approve(/,/^}/c\
pub async fn approve(\
    Path(id): Path<Uuid>,\
    State(state): State<AppState>,\
    Json(req): Json<ApproveRejectRequest>,\
) -> Result<Json<ApiResponse<Event>>> {\
    let pending_event = crate::db::events::get_pending_by_id(\&state.pool, \&id).await?\
        .ok_or_else(|| ApiError::NotFound("Pending event not found".to_string()))?;\
    \
    let event = crate::db::events::approve_pending(\&state.pool, \&id, req.admin_notes.clone()).await?;\
    \
    if let Some(_submitter_email) = \&pending_event.submitter_email {\
        let _ = state.mailer.send_event_approval_notification(\&pending_event, req.admin_notes.as_deref()).await;\
    }\
    \
    Ok(Json(ApiResponse {\
        success: true,\
        data: Some(event),\
        message: Some("Event approved successfully".to_string()),\
    }))\
}' src/handlers/events.rs

# Fix the reject handler with email
sed -i '/pub async fn reject(/,/^}/c\
pub async fn reject(\
    Path(id): Path<Uuid>,\
    State(state): State<AppState>,\
    Json(req): Json<ApproveRejectRequest>,\
) -> Result<Json<ApiResponse<String>>> {\
    let pending_event = crate::db::events::get_pending_by_id(\&state.pool, \&id).await?\
        .ok_or_else(|| ApiError::NotFound("Pending event not found".to_string()))?;\
    \
    crate::db::events::reject_pending(\&state.pool, \&id, req.admin_notes.clone()).await?;\
    \
    if let Some(_submitter_email) = \&pending_event.submitter_email {\
        let _ = state.mailer.send_event_rejection_notification(\&pending_event, req.admin_notes.as_deref()).await;\
    }\
    \
    Ok(Json(ApiResponse {\
        success: true,\
        data: Some("Event rejected".to_string()),\
        message: Some("Event rejected successfully".to_string()),\
    }))\
}' src/handlers/events.rs
