added new method SaveDealYclientsStatus
This commit is contained in:
parent
1d0b0c8b4c
commit
a2b9462ebf
@ -1679,3 +1679,7 @@ WHERE a.result = true AND s.id IS NULL AND a.deleted = false
|
||||
|
||||
-- name: GetQuestionListByQuizID :many
|
||||
SELECT * from question where quiz_id=$1 and deleted = false;
|
||||
|
||||
-- name: SaveDealYclientsStatus :exec
|
||||
INSERT INTO YclientsCRMStatuses (SalonID, RecordID, AnswerID, Status)
|
||||
values ($4, $1, $2, $3);
|
||||
|
||||
@ -149,7 +149,7 @@ CREATE TABLE IF NOT EXISTS YclientsCRMStatuses (
|
||||
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||
AnswerID BIGINT NOT NULL,
|
||||
SalonID INT NOT NULL,
|
||||
RecordID INT, -- ID созданной записи в YClients
|
||||
RecordID INT NOT NULL DEFAULT 0, -- ID созданной записи в YClients
|
||||
Status TEXT NOT NULL DEFAULT '', -- запись о ошибке, либо успехе
|
||||
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
@ -427,12 +427,12 @@ type Yclientsaccountuser struct {
|
||||
}
|
||||
|
||||
type Yclientscrmstatus struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Answerid int64 `db:"answerid" json:"answerid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Recordid sql.NullInt32 `db:"recordid" json:"recordid"`
|
||||
Status string `db:"status" json:"status"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Answerid int64 `db:"answerid" json:"answerid"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
Recordid int32 `db:"recordid" json:"recordid"`
|
||||
Status string `db:"status" json:"status"`
|
||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||
}
|
||||
|
||||
type Yclientsfield struct {
|
||||
|
||||
@ -5871,6 +5871,28 @@ func (q *Queries) ResetQuizPrivilegeUsageCount(ctx context.Context, arg ResetQui
|
||||
return err
|
||||
}
|
||||
|
||||
const saveDealYclientsStatus = `-- name: SaveDealYclientsStatus :exec
|
||||
INSERT INTO YclientsCRMStatuses (SalonID, RecordID, AnswerID, Status)
|
||||
values ($4, $1, $2, $3)
|
||||
`
|
||||
|
||||
type SaveDealYclientsStatusParams struct {
|
||||
Recordid int32 `db:"recordid" json:"recordid"`
|
||||
Answerid int64 `db:"answerid" json:"answerid"`
|
||||
Status string `db:"status" json:"status"`
|
||||
Salonid int32 `db:"salonid" json:"salonid"`
|
||||
}
|
||||
|
||||
func (q *Queries) SaveDealYclientsStatus(ctx context.Context, arg SaveDealYclientsStatusParams) error {
|
||||
_, err := q.db.ExecContext(ctx, saveDealYclientsStatus,
|
||||
arg.Recordid,
|
||||
arg.Answerid,
|
||||
arg.Status,
|
||||
arg.Salonid,
|
||||
)
|
||||
return err
|
||||
}
|
||||
|
||||
const searchIDByAppIDanAppHash = `-- name: SearchIDByAppIDanAppHash :one
|
||||
SELECT id, apiid, apihash, phonenumber, password, status, deleted, createdat FROM tgAccounts WHERE ApiID = $1 and ApiHash=$2 and Deleted = false
|
||||
`
|
||||
|
||||
@ -863,3 +863,25 @@ func (r *YclientsRepository) GettingYclientsUsersTrueResults(ctx context.Context
|
||||
|
||||
return results, nil
|
||||
}
|
||||
|
||||
type SaveDealYclientsDeps struct {
|
||||
RecordID int32
|
||||
AnswerID int64
|
||||
Status string
|
||||
SalonID int32
|
||||
}
|
||||
|
||||
func (r *YclientsRepository) SaveDealYclientsStatus(ctx context.Context, deps SaveDealYclientsDeps) error {
|
||||
err := r.queries.SaveDealYclientsStatus(ctx, sqlcgen.SaveDealYclientsStatusParams{
|
||||
Recordid: deps.RecordID,
|
||||
Answerid: deps.AnswerID,
|
||||
Status: deps.Status,
|
||||
Salonid: deps.SalonID,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user