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