1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: ability to clear all user data (resolve #339)

This commit is contained in:
Ferdinand Mütsch
2022-03-17 11:55:13 +01:00
parent 8e558d8dee
commit e7e5254673
9 changed files with 70 additions and 4 deletions

View File

@@ -176,3 +176,12 @@ func (r *HeartbeatRepository) DeleteBefore(t time.Time) error {
}
return nil
}
func (r *HeartbeatRepository) DeleteByUser(user *models.User) error {
if err := r.db.
Where("user_id = ?", user.ID).
Delete(models.Heartbeat{}).Error; err != nil {
return err
}
return nil
}

View File

@@ -30,6 +30,7 @@ type IHeartbeatRepository interface {
CountByUsers([]*models.User) ([]*models.CountByUser, error)
GetEntitySetByUser(uint8, *models.User) ([]string, error)
DeleteBefore(time.Time) error
DeleteByUser(*models.User) error
}
type IDiagnosticsRepository interface {