mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-09 19:03:37 +02:00
user restricted to own objects
This commit is contained in:
@@ -56,6 +56,7 @@ pub enum IngressContentError {
|
||||
pub async fn create_ingress_objects(
|
||||
input: IngressInput,
|
||||
db_client: &SurrealDbClient,
|
||||
user_id: &str,
|
||||
) -> Result<Vec<IngressObject>, IngressContentError> {
|
||||
// Initialize list
|
||||
let mut object_list = Vec::new();
|
||||
@@ -69,6 +70,7 @@ pub async fn create_ingress_objects(
|
||||
url: url.to_string(),
|
||||
instructions: input.instructions.clone(),
|
||||
category: input.category.clone(),
|
||||
user_id: user_id.into(),
|
||||
});
|
||||
}
|
||||
Err(_) => {
|
||||
@@ -77,6 +79,7 @@ pub async fn create_ingress_objects(
|
||||
text: input_content.to_string(),
|
||||
instructions: input.instructions.clone(),
|
||||
category: input.category.clone(),
|
||||
user_id: user_id.into(),
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -90,6 +93,7 @@ pub async fn create_ingress_objects(
|
||||
file_info,
|
||||
instructions: input.instructions.clone(),
|
||||
category: input.category.clone(),
|
||||
user_id: user_id.into(),
|
||||
});
|
||||
} else {
|
||||
info!("No file with id: {}", id);
|
||||
|
||||
@@ -10,16 +10,19 @@ pub enum IngressObject {
|
||||
url: String,
|
||||
instructions: String,
|
||||
category: String,
|
||||
user_id: String,
|
||||
},
|
||||
Text {
|
||||
text: String,
|
||||
instructions: String,
|
||||
category: String,
|
||||
user_id: String,
|
||||
},
|
||||
File {
|
||||
file_info: FileInfo,
|
||||
instructions: String,
|
||||
category: String,
|
||||
user_id: String,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -37,6 +40,7 @@ impl IngressObject {
|
||||
url,
|
||||
instructions,
|
||||
category,
|
||||
user_id,
|
||||
} => {
|
||||
let text = Self::fetch_text_from_url(url).await?;
|
||||
Ok(TextContent::new(
|
||||
@@ -44,22 +48,26 @@ impl IngressObject {
|
||||
instructions.into(),
|
||||
category.into(),
|
||||
None,
|
||||
user_id.into(),
|
||||
))
|
||||
}
|
||||
IngressObject::Text {
|
||||
text,
|
||||
instructions,
|
||||
category,
|
||||
user_id,
|
||||
} => Ok(TextContent::new(
|
||||
text.into(),
|
||||
instructions.into(),
|
||||
category.into(),
|
||||
None,
|
||||
user_id.into(),
|
||||
)),
|
||||
IngressObject::File {
|
||||
file_info,
|
||||
instructions,
|
||||
category,
|
||||
user_id,
|
||||
} => {
|
||||
let text = Self::extract_text_from_file(file_info).await?;
|
||||
Ok(TextContent::new(
|
||||
@@ -67,6 +75,7 @@ impl IngressObject {
|
||||
instructions.into(),
|
||||
category.into(),
|
||||
Some(file_info.to_owned()),
|
||||
user_id.into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user