update sqlc gen
This commit is contained in:
parent
c23fda5f3f
commit
6982631f2a
@ -134,7 +134,6 @@ SELECT
|
||||
p.amount,
|
||||
p.created_at,
|
||||
a.id,
|
||||
a.email,
|
||||
qz.config
|
||||
FROM
|
||||
privileges AS p
|
||||
@ -144,7 +143,7 @@ WHERE
|
||||
qz.id = $1;
|
||||
|
||||
-- name: CreateAccount :one
|
||||
INSERT INTO account (id, user_id, email, created_at, deleted) VALUES ($1, $2, $3, $4, $5) RETURNING *;;
|
||||
INSERT INTO account (id, user_id, created_at, deleted) VALUES ($1, $2, $3, $4) RETURNING *;
|
||||
|
||||
-- name: DeletePrivilegeByAccID :exec
|
||||
DELETE FROM privileges WHERE account_id = $1;
|
||||
@ -248,7 +247,6 @@ UPDATE privileges SET amount = $1 WHERE id = $2;
|
||||
SELECT
|
||||
a.id,
|
||||
a.user_id,
|
||||
a.email,
|
||||
a.created_at,
|
||||
COALESCE(p.ID,0),
|
||||
coalesce(p.privilegeid,''),
|
||||
|
@ -546,7 +546,7 @@ INSERT INTO question(
|
||||
SELECT $1, title, description, questiontype, required,
|
||||
page, content, version, parent_ids
|
||||
FROM question WHERE question.id=$2
|
||||
RETURNING question.id, quiz_id, created_at, updated_at
|
||||
RETURNING question.id, quiz_id, created_at, updated_at
|
||||
`
|
||||
|
||||
type CopyQuestionParams struct {
|
||||
@ -605,7 +605,7 @@ INSERT INTO quiz(
|
||||
SELECT accountid, archived,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,name,description,config,
|
||||
status,limit_answers,due_to,time_of_passing,pausable,version,version_comment,parent_ids,questions_count, super, group_id
|
||||
FROM quiz WHERE quiz.id=$1 AND quiz.accountId=$2
|
||||
RETURNING id, qid,created_at, updated_at
|
||||
RETURNING id, qid,created_at, updated_at
|
||||
`
|
||||
|
||||
type CopyQuizParams struct {
|
||||
@ -1061,7 +1061,7 @@ INSERT INTO question(
|
||||
SELECT quiz_id, title, description, questiontype, required,
|
||||
page, content, version, parent_ids
|
||||
FROM question WHERE question.id=$1
|
||||
RETURNING question.id, quiz_id, created_at, updated_at
|
||||
RETURNING question.id, quiz_id, created_at, updated_at
|
||||
`
|
||||
|
||||
type DuplicateQuestionRow struct {
|
||||
@ -2841,7 +2841,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), '{}'::jsonb) AS utm
|
||||
,t.accesstoken,r.accountid,r.fieldsrule,r.tagstoadd,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM usersAmo u WHERE u.AmoUserID = r.performerid AND u.deleted = false) AS performer_name,u.subdomain,u.accountid,u.driveurl
|
||||
,t.accesstoken,r.accountid,r.fieldsrule,r.tagstoadd,r.performerid,r.stepid,r.pipelineid,(SELECT u.name FROM usersAmo u WHERE u.AmoUserID = r.performerid AND u.deleted = false) AS performer_name,u.subdomain,u.accountid,u.driveurl
|
||||
FROM answer a
|
||||
INNER JOIN quiz q ON a.quiz_id = q.id
|
||||
LEFT JOIN amoCRMStatuses s ON a.id = s.AnswerID
|
||||
@ -3050,7 +3050,7 @@ INSERT INTO question (
|
||||
updated_at
|
||||
)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)
|
||||
RETURNING id, created_at, updated_at
|
||||
RETURNING id, created_at, updated_at
|
||||
`
|
||||
|
||||
type InsertQuestionParams struct {
|
||||
@ -3110,7 +3110,7 @@ INSERT INTO quiz (accountid,
|
||||
qid
|
||||
)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19)
|
||||
RETURNING id, created_at, updated_at, qid
|
||||
RETURNING id, created_at, updated_at, qid
|
||||
`
|
||||
|
||||
type InsertQuizParams struct {
|
||||
@ -3182,7 +3182,7 @@ INSERT INTO question(
|
||||
SELECT quiz_id, title, description, questiontype, required,
|
||||
page, content, version, parent_ids, true as deleted
|
||||
FROM question WHERE question.id=$1
|
||||
RETURNING question.id, quiz_id, parent_ids
|
||||
RETURNING question.id, quiz_id, parent_ids
|
||||
`
|
||||
|
||||
type MoveToHistoryRow struct {
|
||||
@ -3206,7 +3206,7 @@ INSERT INTO quiz(deleted,
|
||||
SELECT true as deleted, accountid, archived,fingerprinting,repeatable,note_prevented,mail_notifications,unique_answers,name,description,config,
|
||||
status,limit_answers,due_to,time_of_passing,pausable,version,version_comment,parent_ids,questions_count,answers_count,average_time_passing, super, group_id
|
||||
FROM quiz WHERE quiz.id=$1 AND quiz.accountid=$2
|
||||
RETURNING quiz.id, qid, parent_ids
|
||||
RETURNING quiz.id, qid, parent_ids
|
||||
`
|
||||
|
||||
type MoveToHistoryQuizParams struct {
|
||||
@ -3308,7 +3308,7 @@ WITH Funnel AS (
|
||||
q.id, q.title, lc.last_answer_content
|
||||
HAVING
|
||||
COUNT(*) >= 1
|
||||
)
|
||||
)
|
||||
SELECT
|
||||
Funnel.count_start_false,
|
||||
Funnel.count_start_true,
|
||||
@ -3380,18 +3380,18 @@ func (q *Queries) QuestionsStatistics(ctx context.Context, arg QuestionsStatisti
|
||||
}
|
||||
|
||||
const quizCopyQid = `-- name: QuizCopyQid :one
|
||||
INSERT INTO quiz (
|
||||
INSERT INTO quiz (
|
||||
accountid, archived, fingerprinting, repeatable, note_prevented, mail_notifications, unique_answers, name, description, config,
|
||||
status, limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids, questions_count, answers_count, average_time_passing, super, group_id
|
||||
)
|
||||
SELECT
|
||||
)
|
||||
SELECT
|
||||
$2, archived, fingerprinting, repeatable, note_prevented, mail_notifications, unique_answers, name, description, config,
|
||||
status, limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids, questions_count, answers_count, average_time_passing, super, group_id
|
||||
FROM
|
||||
FROM
|
||||
quiz as q
|
||||
WHERE
|
||||
WHERE
|
||||
q.qid = $1
|
||||
RETURNING (select id from quiz where qid = $1),id, qid
|
||||
RETURNING (select id from quiz where qid = $1),id, qid
|
||||
`
|
||||
|
||||
type QuizCopyQidParams struct {
|
||||
@ -3416,7 +3416,7 @@ const setQuizSettings = `-- name: SetQuizSettings :one
|
||||
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,$6 AS TagsToAdd FROM accountsamo u WHERE u.AccountID = $7 AND u.Deleted = false
|
||||
RETURNING id
|
||||
RETURNING id
|
||||
`
|
||||
|
||||
type SetQuizSettingsParams struct {
|
||||
@ -3474,7 +3474,7 @@ WITH amoCompany AS (
|
||||
SELECT AmoID FROM accountsAmo WHERE accountsAmo.AccountID = $1
|
||||
),usersDel AS (
|
||||
UPDATE usersAmo SET Deleted = true WHERE AmoID = (SELECT AmoID FROM amoCompany)
|
||||
),
|
||||
),
|
||||
companyDel AS ( UPDATE accountsAmo SET Deleted = true WHERE AmoID = (SELECT AmoID FROM amoCompany)
|
||||
)
|
||||
DELETE FROM tokens WHERE tokens.AccountID = $1
|
||||
@ -3741,9 +3741,9 @@ const webhookDelete = `-- name: WebhookDelete :exec
|
||||
WITH companyDel AS (
|
||||
UPDATE accountsAmo SET Deleted = true WHERE accountsAmo.AmoID = $1 RETURNING AccountID
|
||||
),
|
||||
userDel AS (
|
||||
UPDATE usersAmo SET Deleted = true WHERE AmoID = $1
|
||||
)
|
||||
userDel AS (
|
||||
UPDATE usersAmo SET Deleted = true WHERE AmoID = $1
|
||||
)
|
||||
DELETE FROM tokens WHERE AccountID IN (SELECT AccountID FROM companyDel)
|
||||
`
|
||||
|
||||
@ -3827,9 +3827,9 @@ SET
|
||||
answers_count = COALESCE(aa.unique_true_answers_count, 0),
|
||||
average_time_passing = COALESCE(sta.average_session_time, 0),
|
||||
sessions_count = COALESCE(sta.sess,0)
|
||||
FROM
|
||||
FROM
|
||||
(SELECT id, qid, accountid, deleted, archived, fingerprinting, repeatable, note_prevented, mail_notifications, unique_answers, super, group_id, name, description, config, status, limit_answers, due_to, time_of_passing, pausable, version, version_comment, parent_ids, created_at, updated_at, questions_count, answers_count, average_time_passing, sessions_count FROM quiz WHERE deleted = FALSE AND archived = FALSE) q_sub
|
||||
LEFT JOIN answer_aggregates aa ON q_sub.id = aa.quiz_id
|
||||
LEFT JOIN answer_aggregates aa ON q_sub.id = aa.quiz_id
|
||||
LEFT JOIN question_aggregates qa ON q_sub.id = qa.quiz_id
|
||||
LEFT JOIN session_times_aggregates sta ON q_sub.id = sta.quiz_id
|
||||
WHERE
|
||||
|
Loading…
Reference in New Issue
Block a user