fix error json scalar
This commit is contained in:
parent
3841028457
commit
db27d4b964
@ -496,15 +496,12 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, accountID st
|
||||
newFields = append(newFields, tools.ToField(createdFields.Embedded.CustomFields, entity)...)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if len(newFields) > 0 {
|
||||
err = m.repo.AmoRepo.CheckFields(ctx, newFields, accountID)
|
||||
if err != nil {
|
||||
m.logger.Error("error updating fields rule in db", zap.Error(err))
|
||||
m.logger.Error("error updating fields rule in db Check Fields", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
}()
|
||||
|
||||
err = m.repo.AmoRepo.CheckFields(ctx, newFields, accountID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
constructFieldRules := func(fieldRuleArrCurrent []model.FieldRule, questions []model.Question, fieldRule *[]model.FieldRule) {
|
||||
@ -535,11 +532,18 @@ func (m *Methods) CheckFieldRule(ctx context.Context, token string, accountID st
|
||||
constructFieldRules(currentFieldsRule.Contact, contactQuestions, &contact)
|
||||
constructFieldRules(currentFieldsRule.Customer, customerQuestions, &customer)
|
||||
constructFieldRules(currentFieldsRule.Company, companyQuestions, &company)
|
||||
// todo pq: cannot call json_array_elements on a scalar
|
||||
return m.repo.AmoRepo.UpdateFieldRules(ctx, model.Fieldsrule{
|
||||
|
||||
err = m.repo.AmoRepo.UpdateFieldRules(ctx, model.Fieldsrule{
|
||||
Lead: lead,
|
||||
Customer: customer,
|
||||
Company: company,
|
||||
Contact: contact,
|
||||
}, accountID, req.QuizID)
|
||||
|
||||
if err != nil {
|
||||
m.logger.Error("error updating fields rule in db", zap.Error(err))
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user