Allow deleting projects from the project picker with x/X.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -153,6 +153,28 @@ func (s *JSONTimeStore) Delete(id string) error {
|
||||
return s.writeUnlocked(out)
|
||||
}
|
||||
|
||||
// DeleteByProject removes all time entries for a project.
|
||||
func (s *JSONTimeStore) DeleteByProject(projectID string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if projectID == "" {
|
||||
return fmt.Errorf("projectId is required")
|
||||
}
|
||||
entries, err := s.readUnlocked()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
out := make([]TimeEntry, 0, len(entries))
|
||||
for _, e := range entries {
|
||||
if e.ProjectID == projectID {
|
||||
continue
|
||||
}
|
||||
out = append(out, e)
|
||||
}
|
||||
return s.writeUnlocked(out)
|
||||
}
|
||||
|
||||
// SumByTicket returns total duration for a ticket.
|
||||
func (s *JSONTimeStore) SumByTicket(ticketID string) (time.Duration, error) {
|
||||
entries, err := s.ListByTicket(ticketID)
|
||||
|
||||
Reference in New Issue
Block a user