use actix_web::{HttpResponse, web}; use crate::api::response::{ApiErrorResponse, ApiResponse}; use crate::error::AppError; use crate::models::notifications::NotificationBlock; use crate::service::AppService; use crate::service::notify::blocks::CreateBlockParams; use crate::session::Session; /// Create a notification block #[utoipa::path( post, path = "/api/v1/notifications/blocks", tag = "Notifications", operation_id = "notificationCreateBlock", request_body( content = CreateBlockParams, description = "Block creation parameters", content_type = "application/json" ), responses( (status = 201, description = "Block created", body = ApiResponse), (status = 401, description = "Authentication required or session expired", body = ApiErrorResponse), (status = 500, description = "Internal server error", body = ApiErrorResponse), ), security( ("session_cookie" = []) ) )] pub async fn create_block( service: web::Data, session: Session, params: web::Json, ) -> Result { let result = service .notify .create_block(&session, params.into_inner()) .await?; Ok(HttpResponse::Created().json(ApiResponse::new(result))) }