Merge branch 'utmFix' into 'staging'
fix, now utm fields does not return to front See merge request backend/quiz/amocrm!20
This commit is contained in:
commit
629c5644d6
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"amocrm/internal/models"
|
||||
"amocrm/internal/tools"
|
||||
"context"
|
||||
"database/sql"
|
||||
"go.uber.org/zap"
|
||||
@ -18,7 +19,7 @@ func (s *Service) GetFieldsWithPagination(ctx context.Context, req *model.Pagina
|
||||
s.logger.Error("error getting fields with pagination", zap.Error(err))
|
||||
return nil, err
|
||||
}
|
||||
return response, nil
|
||||
return tools.ValidateUtmFields(response), nil
|
||||
}
|
||||
|
||||
func (s *Service) UpdateListCustom(ctx context.Context, accountID string) error {
|
||||
|
42
internal/tools/validate.go
Normal file
42
internal/tools/validate.go
Normal file
@ -0,0 +1,42 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||
)
|
||||
|
||||
func ValidateUtmFields(response *model.UserListFieldsResp) *model.UserListFieldsResp {
|
||||
checkUTM := map[string]struct{}{
|
||||
"utm_content": {},
|
||||
"utm_medium": {},
|
||||
"utm_campaign": {},
|
||||
"utm_source": {},
|
||||
"utm_term": {},
|
||||
"utm_referrer": {},
|
||||
"roistat": {},
|
||||
"referrer": {},
|
||||
"openstat_service": {},
|
||||
"openstat_campaign": {},
|
||||
"openstat_ad": {},
|
||||
"openstat_source": {},
|
||||
"from": {},
|
||||
"gclientid": {},
|
||||
"_ym_uid": {},
|
||||
"_ym_counter": {},
|
||||
"gclid": {},
|
||||
"yclid": {},
|
||||
"fbclid": {},
|
||||
}
|
||||
|
||||
data := &model.UserListFieldsResp{
|
||||
Count: response.Count,
|
||||
Items: []model.Field{},
|
||||
}
|
||||
|
||||
for _, r := range response.Items {
|
||||
if _, ok := checkUTM[r.Name]; !ok {
|
||||
data.Items = append(data.Items, r)
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
Loading…
Reference in New Issue
Block a user