Skip to content

Commit

Permalink
feat: implement activity tracking system
Browse files Browse the repository at this point in the history
  • Loading branch information
aliraza556 committed Feb 11, 2025
1 parent af7203a commit b9e78af
Show file tree
Hide file tree
Showing 6 changed files with 625 additions and 1 deletion.
19 changes: 18 additions & 1 deletion db/activities.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,21 @@ func (db database) CreateActivityThread(sourceID string, activity *Activity) (*A
activity.Sequence = len(existingActivities) + 1

return db.CreateActivity(activity)
}
}

func (db database) DeleteActivity(id string) error {
if _, err := uuid.Parse(id); err != nil {
return errors.New("invalid activity ID format")
}

existing := &Activity{}
if err := db.db.Where("id = ?", id).First(existing).Error; err != nil {
return errors.New("activity not found")
}

if err := db.db.Delete(&Activity{}, "id = ?", id).Error; err != nil {
return err
}

return nil
}
1 change: 1 addition & 0 deletions db/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,5 +304,6 @@ type Database interface {
GetActivitiesByWorkspace(workspace string) ([]Activity, error)
GetLatestActivityByThread(threadID string) (*Activity, error)
CreateActivityThread(sourceID string, activity *Activity) (*Activity, error)
DeleteActivity(id string) error
GetBountiesByWorkspaceAndTimeRange(workspaceId string, startDate time.Time, endDate time.Time) ([]NewBounty, error)
}
Loading

0 comments on commit b9e78af

Please sign in to comment.