update amo repo

This commit is contained in:
Pavel 2024-04-29 10:47:20 +03:00
parent 785465b7ad
commit d06dd24c30
2 changed files with 9 additions and 22 deletions

@ -207,12 +207,3 @@ const (
TypeAmoPayer FieldType = "payer" // Плательщик (только в списке Счета-покупки)
TypeAmoSupplier FieldType = "supplier" // Поставщик (только в списке Счета-покупки)
)
type CheckUserUTM struct {
ID int64 `json:"ID"`
Amofieldid int32 `json:"AmoFieldID"`
AmoFieldType EntityType `json:"Entity"`
Quizid int32 `json:"QuizID"`
Accountid int32 `json:"AccountID"`
Name string `json:"Name"`
}

@ -753,24 +753,20 @@ func (r *AmoRepository) GettingUserUtm(ctx context.Context, request *model.Pagin
}, nil
}
func (r *AmoRepository) GetUserUTMByListIDs(ctx context.Context, ids []int32) ([]model.CheckUserUTM, error) {
rows, err := r.queries.GetUserUTMByListIDs(ctx, ids)
func (r *AmoRepository) CheckUserUtms(ctx context.Context, ids []int32) ([]model.UTM, error) {
rows, err := r.queries.CheckUtms(ctx, ids)
if err != nil {
return nil, err
}
var utmS []model.CheckUserUTM
var utmS []model.UTM
for _, row := range rows {
var entity model.EntityType
v := string(row.Amofieldtype.([]byte))
entity = model.EntityType(v)
utm := model.CheckUserUTM{
utm := model.UTM{
ID: row.ID,
Amofieldid: row.Amofieldid,
Quizid: row.Quizid,
Accountid: row.Accountid,
Name: row.Name,
AmoFieldType: entity,
}
utmS = append(utmS, utm)