mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
feat: per-user heartbeats count metrics
This commit is contained in:
@@ -64,6 +64,7 @@ type IUserService interface {
|
||||
GetUserById(string) (*models.User, error)
|
||||
GetUserByKey(string) (*models.User, error)
|
||||
GetAll() ([]*models.User, error)
|
||||
GetActive() ([]*models.User, error)
|
||||
Count() (int64, error)
|
||||
CreateOrGet(*models.Signup, bool) (*models.User, bool, error)
|
||||
Update(*models.User) (*models.User, error)
|
||||
|
@@ -56,6 +56,12 @@ func (srv *UserService) GetAll() ([]*models.User, error) {
|
||||
return srv.repository.GetAll()
|
||||
}
|
||||
|
||||
func (srv *UserService) GetActive() ([]*models.User, error) {
|
||||
// a user is considered active if she has logged in to the web interface at least once within the last x days
|
||||
minDate := time.Now().Add(-24 * time.Hour * time.Duration(srv.Config.App.InactiveDays))
|
||||
return srv.repository.GetByLoggedInAfter(minDate)
|
||||
}
|
||||
|
||||
func (srv *UserService) Count() (int64, error) {
|
||||
return srv.repository.Count()
|
||||
}
|
||||
|
Reference in New Issue
Block a user