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" // Плательщик (только в списке Счета-покупки) TypeAmoPayer FieldType = "payer" // Плательщик (только в списке Счета-покупки)
TypeAmoSupplier FieldType = "supplier" // Поставщик (только в списке Счета-покупки) 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 }, nil
} }
func (r *AmoRepository) GetUserUTMByListIDs(ctx context.Context, ids []int32) ([]model.CheckUserUTM, error) { func (r *AmoRepository) CheckUserUtms(ctx context.Context, ids []int32) ([]model.UTM, error) {
rows, err := r.queries.GetUserUTMByListIDs(ctx, ids) rows, err := r.queries.CheckUtms(ctx, ids)
if err != nil { if err != nil {
return nil, err return nil, err
} }
var utmS []model.CheckUserUTM var utmS []model.UTM
for _, row := range rows { for _, row := range rows {
var entity model.EntityType utm := model.UTM{
v := string(row.Amofieldtype.([]byte)) ID: row.ID,
entity = model.EntityType(v) Amofieldid: row.Amofieldid,
utm := model.CheckUserUTM{ Quizid: row.Quizid,
ID: row.ID, Accountid: row.Accountid,
Amofieldid: row.Amofieldid, Name: row.Name,
Quizid: row.Quizid,
Accountid: row.Accountid,
Name: row.Name,
AmoFieldType: entity,
} }
utmS = append(utmS, utm) utmS = append(utmS, utm)