Add route to create inbox entries
This commit is contained in:
16
moneymgr_backend/src/controllers/inbox_controller.rs
Normal file
16
moneymgr_backend/src/controllers/inbox_controller.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use crate::controllers::HttpResult;
|
||||
use crate::extractors::auth_extractor::AuthExtractor;
|
||||
use crate::services::inbox_service;
|
||||
use crate::services::inbox_service::UpdateInboxEntryQuery;
|
||||
use actix_web::{HttpResponse, web};
|
||||
|
||||
/// Create a new inbox entry
|
||||
pub async fn create(auth: AuthExtractor, req: web::Json<UpdateInboxEntryQuery>) -> HttpResult {
|
||||
if let Some(err) = req.check_error(auth.user_id()).await? {
|
||||
return Ok(HttpResponse::BadRequest().json(err));
|
||||
}
|
||||
|
||||
inbox_service::create(auth.user_id(), &req).await?;
|
||||
|
||||
Ok(HttpResponse::Created().finish())
|
||||
}
|
Reference in New Issue
Block a user