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
|
-- name: GetQuestionListByQuizID :many
|
||||||
SELECT * from question where quiz_id=$1 and deleted = false;
|
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,
|
ID BIGSERIAL UNIQUE NOT NULL PRIMARY KEY,
|
||||||
AnswerID BIGINT NOT NULL,
|
AnswerID BIGINT NOT NULL,
|
||||||
SalonID INT NOT NULL,
|
SalonID INT NOT NULL,
|
||||||
RecordID INT, -- ID созданной записи в YClients
|
RecordID INT NOT NULL DEFAULT 0, -- ID созданной записи в YClients
|
||||||
Status TEXT NOT NULL DEFAULT '', -- запись о ошибке, либо успехе
|
Status TEXT NOT NULL DEFAULT '', -- запись о ошибке, либо успехе
|
||||||
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
CreatedAt TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
);
|
);
|
||||||
|
|||||||
@ -427,12 +427,12 @@ type Yclientsaccountuser struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Yclientscrmstatus struct {
|
type Yclientscrmstatus struct {
|
||||||
ID int64 `db:"id" json:"id"`
|
ID int64 `db:"id" json:"id"`
|
||||||
Answerid int64 `db:"answerid" json:"answerid"`
|
Answerid int64 `db:"answerid" json:"answerid"`
|
||||||
Salonid int32 `db:"salonid" json:"salonid"`
|
Salonid int32 `db:"salonid" json:"salonid"`
|
||||||
Recordid sql.NullInt32 `db:"recordid" json:"recordid"`
|
Recordid int32 `db:"recordid" json:"recordid"`
|
||||||
Status string `db:"status" json:"status"`
|
Status string `db:"status" json:"status"`
|
||||||
Createdat time.Time `db:"createdat" json:"createdat"`
|
Createdat time.Time `db:"createdat" json:"createdat"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Yclientsfield struct {
|
type Yclientsfield struct {
|
||||||
|
|||||||
@ -5871,6 +5871,28 @@ func (q *Queries) ResetQuizPrivilegeUsageCount(ctx context.Context, arg ResetQui
|
|||||||
return err
|
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
|
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
|
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
|
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