mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-17 22:49:43 +02:00
mvp file to ingress fn
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
// === Contents of ./routes/file.rs ===
|
||||
|
||||
use axum::{
|
||||
extract::Path,
|
||||
response::IntoResponse,
|
||||
@@ -9,13 +7,12 @@ use axum::{
|
||||
use axum_typed_multipart::{TypedMultipart, FieldData, TryFromMultipart};
|
||||
use serde_json::json;
|
||||
use tempfile::NamedTempFile;
|
||||
use tracing::{error, info};
|
||||
use tracing::info;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::{
|
||||
models::file_info::{FileError, FileInfo},
|
||||
redis::client::RedisClient,
|
||||
rabbitmq::publisher::RabbitMQProducer,
|
||||
};
|
||||
|
||||
#[derive(Debug, TryFromMultipart)]
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::sync::Arc;
|
||||
use axum::{http::StatusCode, response::IntoResponse, Extension, Json};
|
||||
use tracing::{error, info};
|
||||
|
||||
use crate::{models::ingress::{IngressContent, IngressInput}, rabbitmq::publisher::RabbitMQProducer};
|
||||
use crate::{models::ingress::{IngressContent, IngressInput}, rabbitmq::publisher::RabbitMQProducer, redis::client::RedisClient};
|
||||
|
||||
pub async fn ingress_handler(
|
||||
Extension(producer): Extension<Arc<RabbitMQProducer>>,
|
||||
@@ -11,7 +11,8 @@ pub async fn ingress_handler(
|
||||
) -> impl IntoResponse {
|
||||
info!("Recieved input: {:?}", input);
|
||||
|
||||
if let Ok(content) = IngressContent::new(input).await {
|
||||
let redis_client = RedisClient::new("redis://127.0.0.1/");
|
||||
if let Ok(content) = IngressContent::new(input, &redis_client).await {
|
||||
|
||||
// Publish content to RabbitMQ (or other system)
|
||||
match producer.publish(&content).await {
|
||||
|
||||
Reference in New Issue
Block a user