summaryrefslogtreecommitdiff
path: root/makima/src/server/handlers/contracts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'makima/src/server/handlers/contracts.rs')
-rw-r--r--makima/src/server/handlers/contracts.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/makima/src/server/handlers/contracts.rs b/makima/src/server/handlers/contracts.rs
index a3aa00a..3ce29e1 100644
--- a/makima/src/server/handlers/contracts.rs
+++ b/makima/src/server/handlers/contracts.rs
@@ -631,6 +631,22 @@ pub async fn add_remote_repository(
Ok(repo) => {
// Update supervisor task with repository info if this is a primary repo
update_supervisor_with_repo_if_needed(pool, id, auth.owner_id, &repo).await;
+
+ // Track repository in history for future suggestions
+ if let Err(e) = repository::add_or_update_repository_history(
+ pool,
+ auth.owner_id,
+ &req.name,
+ Some(&req.repository_url),
+ None,
+ "remote",
+ )
+ .await
+ {
+ // Log but don't fail the request if history tracking fails
+ tracing::warn!("Failed to track repository in history: {}", e);
+ }
+
(StatusCode::CREATED, Json(repo)).into_response()
}
Err(e) => {
@@ -705,6 +721,22 @@ pub async fn add_local_repository(
Ok(repo) => {
// Update supervisor task with repository info if this is a primary repo
update_supervisor_with_repo_if_needed(pool, id, auth.owner_id, &repo).await;
+
+ // Track repository in history for future suggestions
+ if let Err(e) = repository::add_or_update_repository_history(
+ pool,
+ auth.owner_id,
+ &req.name,
+ None,
+ Some(&req.local_path),
+ "local",
+ )
+ .await
+ {
+ // Log but don't fail the request if history tracking fails
+ tracing::warn!("Failed to track repository in history: {}", e);
+ }
+
(StatusCode::CREATED, Json(repo)).into_response()
}
Err(e) => {