|
@@ -61,7 +61,7 @@ func (r *allowAndDenyIpRepository) DeleteAllowAndDenyIps(ctx context.Context, id
|
|
|
|
|
|
func (r *allowAndDenyIpRepository) GetAllowAndDenyIpsAllByHostId(ctx context.Context, hostId int64) ([]*model.AllowAndDenyIp, error) {
|
|
func (r *allowAndDenyIpRepository) GetAllowAndDenyIpsAllByHostId(ctx context.Context, hostId int64) ([]*model.AllowAndDenyIp, error) {
|
|
var res []*model.AllowAndDenyIp
|
|
var res []*model.AllowAndDenyIp
|
|
- if err := r.DB(ctx).Where("host_id = ?", hostId).Find(&res).Error; err != nil {
|
|
|
|
|
|
+ if err := r.DB(ctx).Model(&model.AllowAndDenyIp{}).Where("host_id = ?", hostId).Find(&res).Error; err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
return res, nil
|
|
return res, nil
|
|
@@ -69,7 +69,7 @@ func (r *allowAndDenyIpRepository) GetAllowAndDenyIpsAllByHostId(ctx context.Con
|
|
|
|
|
|
func (r *allowAndDenyIpRepository) GetIpCount(ctx context.Context,hostId int64,ip string) (int64, error) {
|
|
func (r *allowAndDenyIpRepository) GetIpCount(ctx context.Context,hostId int64,ip string) (int64, error) {
|
|
var count int64
|
|
var count int64
|
|
- if err := r.DB(ctx).Where("host_id = ?", hostId).Where("ip = ?", ip).Count(&count).Error; err != nil {
|
|
|
|
|
|
+ if err := r.DB(ctx).Model(&model.AllowAndDenyIp{}).Where("host_id = ?", hostId).Where("ip = ?", ip).Count(&count).Error; err != nil {
|
|
return 0, err
|
|
return 0, err
|
|
}
|
|
}
|
|
return count, nil
|
|
return count, nil
|