update query
This commit is contained in:
parent
1e97acc6a9
commit
629c956e37
@ -1048,7 +1048,7 @@ RETURNING p.id, p.privilegeID, p.account_id, p.privilege_name, p.amount, p.creat
|
||||
|
||||
-- name: GetExistingContactAmo :one
|
||||
SELECT ID, AccountID, AmoID, Field
|
||||
FROM amoContact WHERE AccountID = $1 AND (Field = $2 OR Field = $3);
|
||||
FROM amoContact WHERE AccountID = $1 AND Field = $2;
|
||||
|
||||
-- name: InsertContactAmo :one
|
||||
INSERT INTO amoContact (AccountID, AmoID, Field) VALUES ($1, $2, $3) RETURNING AmoID;
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/dal/sqlcgen"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/model"
|
||||
"penahub.gitlab.yandexcloud.net/backend/quiz/common.git/pj_errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -1080,3 +1081,26 @@ func (r *AmoRepository) UpdatingDealAmoStatus(ctx context.Context, deps SaveDeal
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// методы для contact в амо
|
||||
|
||||
func (r *AmoRepository) GetExistingContactAmo(ctx context.Context, accountID int32, email, phone string) (model.ContactAmo, error) {
|
||||
row, err := r.queries.GetExistingContactAmo(ctx, sqlcgen.GetExistingContactAmoParams{
|
||||
Accountid: accountID,
|
||||
Field: email,
|
||||
Field_2: phone,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return model.ContactAmo{}, pj_errors.ErrNotFound
|
||||
}
|
||||
return model.ContactAmo{}, err
|
||||
}
|
||||
|
||||
return model.ContactAmo{
|
||||
ID: row.ID,
|
||||
AccountID: row.Accountid,
|
||||
AmoID: row.Amoid,
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user