feat: Enhance validation and permissions handling across controllers
- Added `ValidatedJson` extractor for automatic JSON validation in `events_controller.rs`, `testimonials_controller.rs`, `mentors_controller.rs`, `gacha_items_controller.rs`, and `hackathon_controller.rs`. - Replaced manual permission checks with `require_permissions!` and `require_auth!` macros in relevant controllers to streamline permission handling. - Introduced `sanitization` utilities in `sanitization.rs` for improved input sanitization. - Added `permission_macros.rs` to encapsulate permission checking logic and reduce boilerplate. - Updated dependencies in `Cargo.toml` to include `serde_json` and `validator`. - Implemented error handling improvements in `notification_service.rs` for better response management.
This commit is contained in:
@@ -3,12 +3,16 @@
|
||||
//! This module provides utilities for initializing and running an Axum web server
|
||||
//! with SurrealDB connections for both WebSocket and in-memory databases.
|
||||
|
||||
pub mod validated_json;
|
||||
|
||||
use crate::{surrealdb_init_mem, surrealdb_init_ws, SurrealMemClient, SurrealWsClient};
|
||||
use axum::{Router, serve};
|
||||
use std::{future::Future, net::SocketAddr};
|
||||
use tokio::net::TcpListener;
|
||||
use crate::environment::ENV;
|
||||
|
||||
pub use validated_json::ValidatedJson;
|
||||
|
||||
/// Initialize and start the Axum server with SurrealDB connections.
|
||||
///
|
||||
/// This function sets up both WebSocket and in-memory SurrealDB connections,
|
||||
|
||||
Reference in New Issue
Block a user