update sqlc gen
This commit is contained in:
parent
a5a4d9bfc6
commit
41ba9e34e3
@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/sqlc-dev/pqtype"
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
@ -130,15 +131,16 @@ type Quiz struct {
|
||||
}
|
||||
|
||||
type Rule struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Deleted bool `db:"deleted" json:"deleted"`
|
||||
Createdat sql.NullTime `db:"createdat" json:"createdat"`
|
||||
Tagstoadd pqtype.NullRawMessage `db:"tagstoadd" json:"tagstoadd"`
|
||||
}
|
||||
|
||||
type Step struct {
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/lib/pq"
|
||||
"github.com/sqlc-dev/pqtype"
|
||||
)
|
||||
|
||||
const accountPagination = `-- name: AccountPagination :many
|
||||
@ -116,18 +117,19 @@ func (q *Queries) ArchiveQuiz(ctx context.Context, arg ArchiveQuizParams) error
|
||||
|
||||
const changeQuizSettings = `-- name: ChangeQuizSettings :one
|
||||
UPDATE rules
|
||||
SET PerformerID = $1,PipelineID = $2,StepID = $3,FieldsRule = $4
|
||||
WHERE AccountID = (SELECT AmoID FROM users WHERE users.AccountID = $5 AND users.Deleted = false) AND QuizID = $6 AND Deleted = false
|
||||
SET PerformerID = $1,PipelineID = $2,StepID = $3,FieldsRule = $4, TagsToAdd=$5
|
||||
WHERE AccountID = (SELECT AmoID FROM users WHERE users.AccountID = $6 AND users.Deleted = false) AND QuizID = $7 AND Deleted = false
|
||||
RETURNING id
|
||||
`
|
||||
|
||||
type ChangeQuizSettingsParams struct {
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Tagstoadd pqtype.NullRawMessage `db:"tagstoadd" json:"tagstoadd"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
}
|
||||
|
||||
func (q *Queries) ChangeQuizSettings(ctx context.Context, arg ChangeQuizSettingsParams) (int64, error) {
|
||||
@ -136,6 +138,7 @@ func (q *Queries) ChangeQuizSettings(ctx context.Context, arg ChangeQuizSettings
|
||||
arg.Pipelineid,
|
||||
arg.Stepid,
|
||||
arg.Fieldsrule,
|
||||
arg.Tagstoadd,
|
||||
arg.Accountid,
|
||||
arg.Quizid,
|
||||
)
|
||||
@ -2279,7 +2282,7 @@ func (q *Queries) GetQuizHistory(ctx context.Context, arg GetQuizHistoryParams)
|
||||
}
|
||||
|
||||
const getQuizRule = `-- name: GetQuizRule :one
|
||||
SELECT id, accountid, quizid, performerid, pipelineid, stepid, fieldsrule, deleted, createdat FROM rules WHERE QuizID = $1 AND Deleted = false
|
||||
SELECT id, accountid, quizid, performerid, pipelineid, stepid, fieldsrule, deleted, createdat, tagstoadd FROM rules WHERE QuizID = $1 AND Deleted = false
|
||||
`
|
||||
|
||||
func (q *Queries) GetQuizRule(ctx context.Context, quizid int32) (Rule, error) {
|
||||
@ -2295,6 +2298,7 @@ func (q *Queries) GetQuizRule(ctx context.Context, quizid int32) (Rule, error) {
|
||||
&i.Fieldsrule,
|
||||
&i.Deleted,
|
||||
&i.Createdat,
|
||||
&i.Tagstoadd,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
@ -2810,7 +2814,7 @@ SELECT a.quiz_id,a.id,a.result,a.question_id,a.content,a.session,
|
||||
FROM answer a2
|
||||
WHERE a2.start = true AND a2.session = a.session
|
||||
LIMIT 1) AS utm
|
||||
,t.accesstoken,r.accountid,r.fieldsrule,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM users u WHERE u.amoid = r.performerid) AS performer_name,u.subdomain
|
||||
,t.accesstoken,r.accountid,r.fieldsrule,r.tagstoadd,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM users u WHERE u.amoid = r.performerid) AS performer_name,u.subdomain
|
||||
FROM answer a
|
||||
INNER JOIN quiz q ON a.quiz_id = q.id
|
||||
LEFT JOIN amoCRMStatuses s ON a.id = s.AnswerID
|
||||
@ -2826,21 +2830,22 @@ WHERE a.result = true
|
||||
`
|
||||
|
||||
type GettingAmoUsersTrueResultsRow struct {
|
||||
QuizID int64 `db:"quiz_id" json:"quiz_id"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Result sql.NullBool `db:"result" json:"result"`
|
||||
QuestionID int64 `db:"question_id" json:"question_id"`
|
||||
Content sql.NullString `db:"content" json:"content"`
|
||||
Session sql.NullString `db:"session" json:"session"`
|
||||
Utm json.RawMessage `db:"utm" json:"utm"`
|
||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
PerformerName string `db:"performer_name" json:"performer_name"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
QuizID int64 `db:"quiz_id" json:"quiz_id"`
|
||||
ID int64 `db:"id" json:"id"`
|
||||
Result sql.NullBool `db:"result" json:"result"`
|
||||
QuestionID int64 `db:"question_id" json:"question_id"`
|
||||
Content sql.NullString `db:"content" json:"content"`
|
||||
Session sql.NullString `db:"session" json:"session"`
|
||||
Utm json.RawMessage `db:"utm" json:"utm"`
|
||||
Accesstoken string `db:"accesstoken" json:"accesstoken"`
|
||||
Accountid int32 `db:"accountid" json:"accountid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Tagstoadd pqtype.NullRawMessage `db:"tagstoadd" json:"tagstoadd"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
PerformerName string `db:"performer_name" json:"performer_name"`
|
||||
Subdomain string `db:"subdomain" json:"subdomain"`
|
||||
}
|
||||
|
||||
func (q *Queries) GettingAmoUsersTrueResults(ctx context.Context) ([]GettingAmoUsersTrueResultsRow, error) {
|
||||
@ -2863,6 +2868,7 @@ func (q *Queries) GettingAmoUsersTrueResults(ctx context.Context) ([]GettingAmoU
|
||||
&i.Accesstoken,
|
||||
&i.Accountid,
|
||||
&i.Fieldsrule,
|
||||
&i.Tagstoadd,
|
||||
&i.Performerid,
|
||||
&i.Stepid,
|
||||
&i.Pipelineid,
|
||||
@ -3359,19 +3365,20 @@ func (q *Queries) QuizCopyQid(ctx context.Context, arg QuizCopyQidParams) (QuizC
|
||||
}
|
||||
|
||||
const setQuizSettings = `-- name: SetQuizSettings :one
|
||||
INSERT INTO rules (AccountID, QuizID, PerformerID, PipelineID, StepID, FieldsRule)
|
||||
INSERT INTO rules (AccountID, QuizID, PerformerID, PipelineID, StepID, FieldsRule,TagsToAdd)
|
||||
SELECT u.AmoID AS AccountID,$1 AS QuizID,$2 AS PerformerID,$3 AS PipelineID,
|
||||
$4 AS StepID,$5 AS FieldsRule FROM users u WHERE u.AccountID = $6 AND u.Deleted = false
|
||||
$4 AS StepID,$5 AS FieldsRule,$6 AS TagsToAdd FROM users u WHERE u.AccountID = $7 AND u.Deleted = false
|
||||
RETURNING id
|
||||
`
|
||||
|
||||
type SetQuizSettingsParams struct {
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
Quizid int32 `db:"quizid" json:"quizid"`
|
||||
Performerid int32 `db:"performerid" json:"performerid"`
|
||||
Pipelineid int32 `db:"pipelineid" json:"pipelineid"`
|
||||
Stepid int32 `db:"stepid" json:"stepid"`
|
||||
Fieldsrule json.RawMessage `db:"fieldsrule" json:"fieldsrule"`
|
||||
Tagstoadd pqtype.NullRawMessage `db:"tagstoadd" json:"tagstoadd"`
|
||||
Accountid string `db:"accountid" json:"accountid"`
|
||||
}
|
||||
|
||||
func (q *Queries) SetQuizSettings(ctx context.Context, arg SetQuizSettingsParams) (int64, error) {
|
||||
@ -3381,6 +3388,7 @@ func (q *Queries) SetQuizSettings(ctx context.Context, arg SetQuizSettingsParams
|
||||
arg.Pipelineid,
|
||||
arg.Stepid,
|
||||
arg.Fieldsrule,
|
||||
arg.Tagstoadd,
|
||||
arg.Accountid,
|
||||
)
|
||||
var id int64
|
||||
|
Loading…
Reference in New Issue
Block a user