Fix storage backend extensibility by adding DeleteIssue to Storage interface
- Added DeleteIssue to Storage interface - Implemented DeleteIssue in MemoryStorage backend - Removed brittle type assertion from deletion_tracking.go - Closes bd-1fkr
This commit is contained in:
@@ -406,6 +406,29 @@ func (m *MemoryStorage) CloseIssue(ctx context.Context, id string, reason string
|
||||
}, actor)
|
||||
}
|
||||
|
||||
// DeleteIssue permanently deletes an issue and all associated data
|
||||
func (m *MemoryStorage) DeleteIssue(ctx context.Context, id string) error {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
|
||||
// Check if issue exists
|
||||
if _, ok := m.issues[id]; !ok {
|
||||
return fmt.Errorf("issue not found: %s", id)
|
||||
}
|
||||
|
||||
// Delete the issue
|
||||
delete(m.issues, id)
|
||||
|
||||
// Delete associated data
|
||||
delete(m.dependencies, id)
|
||||
delete(m.labels, id)
|
||||
delete(m.events, id)
|
||||
delete(m.comments, id)
|
||||
delete(m.dirty, id)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// SearchIssues finds issues matching query and filters
|
||||
func (m *MemoryStorage) SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error) {
|
||||
m.mu.RLock()
|
||||
|
||||
@@ -17,6 +17,7 @@ type Storage interface {
|
||||
GetIssueByExternalRef(ctx context.Context, externalRef string) (*types.Issue, error)
|
||||
UpdateIssue(ctx context.Context, id string, updates map[string]interface{}, actor string) error
|
||||
CloseIssue(ctx context.Context, id string, reason string, actor string) error
|
||||
DeleteIssue(ctx context.Context, id string) error
|
||||
SearchIssues(ctx context.Context, query string, filter types.IssueFilter) ([]*types.Issue, error)
|
||||
|
||||
// Dependencies
|
||||
|
||||
Reference in New Issue
Block a user