feat: site count
This commit is contained in:
@@ -122,4 +122,5 @@ type Site interface {
|
||||
GetByID(ctx context.Context, id int64) (*entity.Site, error)
|
||||
GetAll(ctx context.Context, search entity.SiteSearch) ([]*entity.Site, int, error)
|
||||
Delete(ctx mycontext.Context, id int64) error
|
||||
Count(ctx mycontext.Context, req entity.SiteSearch) (*entity.SiteCount, error)
|
||||
}
|
||||
|
||||
@@ -87,3 +87,13 @@ func (s *SiteService) Delete(ctx mycontext.Context, id int64) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *SiteService) Count(ctx mycontext.Context, req entity.SiteSearch) (*entity.SiteCount, error) {
|
||||
count, err := s.repo.Count(ctx, req)
|
||||
if err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when getting all sites", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return count.ToSiteCount(), nil
|
||||
}
|
||||
Reference in New Issue
Block a user