Allow moving tickets between projects with P.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -153,6 +153,34 @@ func (s *JSONTimeStore) Delete(id string) error {
|
||||
return s.writeUnlocked(out)
|
||||
}
|
||||
|
||||
// RetargetTicket sets ProjectID on all entries for a ticket.
|
||||
func (s *JSONTimeStore) RetargetTicket(ticketID, projectID string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
if ticketID == "" {
|
||||
return fmt.Errorf("ticketId is required")
|
||||
}
|
||||
if projectID == "" {
|
||||
return fmt.Errorf("projectId is required")
|
||||
}
|
||||
entries, err := s.readUnlocked()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
changed := false
|
||||
for i := range entries {
|
||||
if entries[i].TicketID == ticketID {
|
||||
entries[i].ProjectID = projectID
|
||||
changed = true
|
||||
}
|
||||
}
|
||||
if !changed {
|
||||
return nil
|
||||
}
|
||||
return s.writeUnlocked(entries)
|
||||
}
|
||||
|
||||
// DeleteByProject removes all time entries for a project.
|
||||
func (s *JSONTimeStore) DeleteByProject(projectID string) error {
|
||||
s.mu.Lock()
|
||||
|
||||
Reference in New Issue
Block a user