Remove group all checks for accounts during startup

Signed-off-by: bcmmbaga <bethuelmbaga12@gmail.com>
This commit is contained in:
bcmmbaga
2024-11-22 18:07:23 +03:00
parent 2115e2c3f0
commit ea51ce876e
4 changed files with 30 additions and 26 deletions

View File

@@ -877,6 +877,17 @@ func (s *SqlStore) GetAccountCreatedBy(ctx context.Context, lockStrength Locking
return createdBy, nil
}
func (s *SqlStore) GetTotalAccounts(ctx context.Context, lockStrength LockingStrength) (int64, error) {
var count int64
result := s.db.Clauses(clause.Locking{Strength: string(lockStrength)}).Model(&Account{}).Count(&count)
if result.Error != nil {
log.WithContext(ctx).Errorf("failed to get total accounts from store: %s", result.Error)
return 0, status.Errorf(status.Internal, "failed to get total accounts from store")
}
return count, nil
}
// SaveUserLastLogin stores the last login time for a user in DB.
func (s *SqlStore) SaveUserLastLogin(ctx context.Context, accountID, userID string, lastLogin time.Time) error {
var user User