package usecase import ( "users_management/m/model/entity" "users_management/m/repository" ) type CountAssetsUseCase interface { GetCounts() (entity.CountAssets, error) } type countAssetsUseCase struct { countAssetsRepo repository.CountAssetsRepo } func NewCountAssetsUseCase(countAssetsRepo repository.CountAssetsRepo) CountAssetsUseCase { return &countAssetsUseCase{ countAssetsRepo: countAssetsRepo, } } func (uc *countAssetsUseCase) GetCounts() (entity.CountAssets, error) { // Update counts before returning err := uc.countAssetsRepo.UpdateCounts() if err != nil { return entity.CountAssets{}, err } // Get the updated counts return uc.countAssetsRepo.Get() }