refactor: remove content_url from item metadata

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-29 11:52:25 -03:00
parent 713f33ad87
commit 59e1ecd181

View File

@@ -74,11 +74,7 @@ pub async fn handle_list_items(
.map(|item_with_meta| { .map(|item_with_meta| {
let item_id = item_with_meta.item.id.unwrap_or(0); let item_id = item_with_meta.item.id.unwrap_or(0);
let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect(); let item_tags: Vec<String> = item_with_meta.tags.iter().map(|t| t.name.clone()).collect();
let mut item_meta = item_with_meta.meta_as_map(); let item_meta = item_with_meta.meta_as_map();
// Add content_url to metadata
// Note: We don't have access to the host here, so we'll use a placeholder
// The user may need to provide the base URL through AppState
item_meta.insert("content_url".to_string(), format!("/api/item/{}/content", item_id));
ItemInfo { ItemInfo {
id: item_id, id: item_id,
@@ -598,11 +594,7 @@ pub async fn handle_get_item_latest_meta(
match item_service.find_item(vec![], tags, HashMap::new()).await { match item_service.find_item(vec![], tags, HashMap::new()).await {
Ok(item_with_meta) => { Ok(item_with_meta) => {
let mut item_meta = item_with_meta.meta_as_map(); let item_meta = item_with_meta.meta_as_map();
// Add content_url to metadata
if let Some(item_id) = item_with_meta.item.id {
item_meta.insert("content_url".to_string(), format!("/api/item/{}/content", item_id));
}
let response = ApiResponse { let response = ApiResponse {
success: true, success: true,
@@ -655,9 +647,7 @@ pub async fn handle_get_item_meta(
match item_service.get_item(item_id).await { match item_service.get_item(item_id).await {
Ok(item_with_meta) => { Ok(item_with_meta) => {
let mut item_meta = item_with_meta.meta_as_map(); let item_meta = item_with_meta.meta_as_map();
// Add content_url to metadata
item_meta.insert("content_url".to_string(), format!("/api/item/{}/content", item_id));
let response = ApiResponse { let response = ApiResponse {
success: true, success: true,