update amo repo methods
This commit is contained in:
parent
ff9d34fa84
commit
ccbdad7e64
@ -208,12 +208,3 @@ const (
|
|||||||
TypeAmoSupplier FieldType = "supplier" // Поставщик (только в списке Счета-покупки)
|
TypeAmoSupplier FieldType = "supplier" // Поставщик (только в списке Счета-покупки)
|
||||||
TypeAmoMultiText FieldType = "multitext" // что то чего нет в списке полей но она есть в амо))
|
TypeAmoMultiText FieldType = "multitext" // что то чего нет в списке полей но она есть в амо))
|
||||||
)
|
)
|
||||||
|
|
||||||
type CheckUserUtm struct {
|
|
||||||
ID int64 `json:"ID"`
|
|
||||||
Amofieldid int32 `json:"AmoFieldID"`
|
|
||||||
Quizid int32 `json:"QuizID"`
|
|
||||||
Accountid int32 `json:"AccountID"`
|
|
||||||
Name string `json:"Name"`
|
|
||||||
AmoFieldName string
|
|
||||||
}
|
|
||||||
|
@ -593,6 +593,38 @@ func (r *AmoRepository) CheckFields(ctx context.Context, fields []model.Field, t
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *AmoRepository) GetUserFieldsByID(ctx context.Context, accountID int32) ([]model.Field, error) {
|
||||||
|
rows, err := r.queries.GetUserFieldsByID(ctx, accountID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
var fields []model.Field
|
||||||
|
for _, row := range rows {
|
||||||
|
|
||||||
|
var entity model.EntityType
|
||||||
|
v := string(row.Entity.([]byte))
|
||||||
|
entity = model.EntityType(v)
|
||||||
|
|
||||||
|
var fieldType model.FieldType
|
||||||
|
f := string(row.Type.([]byte))
|
||||||
|
fieldType = model.FieldType(f)
|
||||||
|
|
||||||
|
field := model.Field{
|
||||||
|
ID: row.ID,
|
||||||
|
Amoid: row.Amoid,
|
||||||
|
Code: row.Code,
|
||||||
|
Accountid: row.Accountid,
|
||||||
|
Name: row.Name,
|
||||||
|
Entity: entity,
|
||||||
|
Type: fieldType,
|
||||||
|
}
|
||||||
|
|
||||||
|
fields = append(fields, field)
|
||||||
|
}
|
||||||
|
|
||||||
|
return fields, err
|
||||||
|
}
|
||||||
|
|
||||||
// методы rules
|
// методы rules
|
||||||
|
|
||||||
func (r *AmoRepository) ChangeQuizSettings(ctx context.Context, request *model.RulesReq, accountID string, quizID int) (*model.Rule, error) {
|
func (r *AmoRepository) ChangeQuizSettings(ctx context.Context, request *model.RulesReq, accountID string, quizID int) (*model.Rule, error) {
|
||||||
@ -753,21 +785,20 @@ func (r *AmoRepository) GettingUserUtm(ctx context.Context, request *model.Pagin
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *AmoRepository) CheckUserUtms(ctx context.Context, ids []int32) ([]model.CheckUserUtm, error) {
|
func (r *AmoRepository) GetUtmsByID(ctx context.Context, ids []int32) ([]model.UTM, error) {
|
||||||
rows, err := r.queries.CheckUtms(ctx, ids)
|
rows, err := r.queries.GetUtmsByID(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 {
|
||||||
utm := model.CheckUserUtm{
|
utm := model.UTM{
|
||||||
ID: row.ID,
|
ID: row.ID,
|
||||||
Amofieldid: row.Amofieldid,
|
Amofieldid: row.Amofieldid,
|
||||||
Quizid: row.Quizid,
|
Quizid: row.Quizid,
|
||||||
Accountid: row.Accountid,
|
Accountid: row.Accountid,
|
||||||
Name: row.Name,
|
Name: row.Name,
|
||||||
AmoFieldName: row.Name_2.String,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
utmS = append(utmS, utm)
|
utmS = append(utmS, utm)
|
||||||
|
Loading…
Reference in New Issue
Block a user