Update Filter
This commit is contained in:
@@ -93,6 +93,10 @@ func (b *PartnerRepository) GetAll(ctx context.Context, req entity.PartnerSearch
|
||||
query = query.Where("p.name ILIKE ?", "%"+req.Name+"%")
|
||||
}
|
||||
|
||||
if req.PartnerID != nil {
|
||||
query = query.Where("p.id = ?", req.PartnerID)
|
||||
}
|
||||
|
||||
if req.Limit > 0 {
|
||||
query = query.Limit(req.Limit)
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ func (b *UserRepository) GetAllUsers(ctx context.Context, req entity.UserSearch)
|
||||
query = query.Where("ur.partner_id = ? ", req.PartnerID)
|
||||
}
|
||||
|
||||
if req.SiteID > 0 {
|
||||
query = query.Where("ur.site_id = ? ", req.SiteID)
|
||||
}
|
||||
|
||||
// Get the total count without applying the limit and offset.
|
||||
if err := query.Model(&entity.UserDB{}).Count(&total).Error; err != nil {
|
||||
logger.ContextLogger(ctx).Error("error when count users", zap.Error(err))
|
||||
|
||||
Reference in New Issue
Block a user