From 764bd28d08ceaef03cd4050f9568a62d77bbcfca Mon Sep 17 00:00:00 2001 From: soryu Date: Thu, 15 Jan 2026 03:37:44 +0000 Subject: Add repository history feature to store and suggest previously used repositories (#18) - Add repository_history table migration with repo_type, repo_path, use_count, last_used_at - Add RepositoryHistoryEntry model and CRUD database functions - Create API endpoints: GET/POST/DELETE /api/v1/repository-history, GET /api/v1/repository-history/suggestions - Update add_remote_repository and add_local_repository handlers to automatically track history - Update frontend API with repository history types and functions - Add Repository History section to Settings page with list of entries and delete functionality - Add suggestions dropdown to RepositoryPanel when entering new repository URL/path - Suggestions filter by repo type (remote vs local) and match on user input Test plan: - Add a remote repository to a contract - verify it appears in Settings history - Add a local repository to a contract - verify it appears in Settings history - Add same repository again - verify use_count increments, not duplicate - When adding new repository, verify suggestions appear based on history - Delete a history entry from Settings - verify it's removed - Verify suggestions only show matching type (remote for remote, local for local) Co-authored-by: Claude Opus 4.5 --- makima/src/db/models.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'makima/src/db/models.rs') diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index ca12eb2..8ab3a10 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -1507,3 +1507,42 @@ pub struct DaemonWithCapacity { pub last_heartbeat_at: DateTime, pub connected_at: DateTime, } + +// ============================================================================ +// Repository History (for storing and suggesting previously used repositories) +// ============================================================================ + +/// Repository history entry - tracks previously used repositories for suggestions +#[derive(Debug, Clone, FromRow, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct RepositoryHistoryEntry { + pub id: Uuid, + pub owner_id: Uuid, + pub name: String, + pub repository_url: Option, + pub local_path: Option, + pub source_type: String, + pub use_count: i32, + pub last_used_at: DateTime, + pub created_at: DateTime, +} + +/// Response for repository history list endpoint +#[derive(Debug, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct RepositoryHistoryListResponse { + pub entries: Vec, + pub total: i64, +} + +/// Request for getting repository suggestions +#[derive(Debug, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct RepositorySuggestionsQuery { + /// Filter by source type: 'remote' or 'local' + pub source_type: Option, + /// Optional search query to filter by name or URL/path + pub query: Option, + /// Limit results (default: 10) + pub limit: Option, +} -- cgit v1.2.3