This commit is contained in:
Pavel 2025-04-23 17:03:14 +03:00
parent 7b13febe87
commit 54f47a2cf8
4 changed files with 54 additions and 38 deletions

@ -1092,5 +1092,5 @@ SELECT qz.accountid FROM question q
-- name: CheckQuizOwner :one
SELECT accountid FROM quiz WHERE id = $1 AND accountid = $2;
-- name: CheckLeadTargetOwner:one
SELECT accountid FROM leadtarget WHERE id = $1 AND accountid = $2;
-- name: CheckLeadTargetOwner :one
SELECT accountid FROM leadtarget WHERE id = $1 AND accountid = $2;

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// sqlc v1.28.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// sqlc v1.28.0
package sqlcgen

@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// sqlc v1.28.0
// source: queries.sql
package sqlcgen
@ -283,6 +283,22 @@ func (q *Queries) CheckFields(ctx context.Context, arg CheckFieldsParams) ([]Che
return items, nil
}
const checkLeadTargetOwner = `-- name: CheckLeadTargetOwner :one
SELECT accountid FROM leadtarget WHERE id = $1 AND accountid = $2
`
type CheckLeadTargetOwnerParams struct {
ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) CheckLeadTargetOwner(ctx context.Context, arg CheckLeadTargetOwnerParams) (string, error) {
row := q.db.QueryRowContext(ctx, checkLeadTargetOwner, arg.ID, arg.Accountid)
var accountid string
err := row.Scan(&accountid)
return accountid, err
}
const checkPipelines = `-- name: CheckPipelines :many
WITH new_pipelines AS (
SELECT (pipeline->>'AmoID')::INT AS amoID,
@ -348,6 +364,39 @@ func (q *Queries) CheckPipelines(ctx context.Context, dollar_1 json.RawMessage)
return items, nil
}
const checkQuestionOwner = `-- name: CheckQuestionOwner :one
SELECT qz.accountid FROM question q
JOIN quiz qz ON q.quiz_id = qz.id WHERE q.id = $1 AND qz.accountid = $2
`
type CheckQuestionOwnerParams struct {
ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) CheckQuestionOwner(ctx context.Context, arg CheckQuestionOwnerParams) (string, error) {
row := q.db.QueryRowContext(ctx, checkQuestionOwner, arg.ID, arg.Accountid)
var accountid string
err := row.Scan(&accountid)
return accountid, err
}
const checkQuizOwner = `-- name: CheckQuizOwner :one
SELECT accountid FROM quiz WHERE id = $1 AND accountid = $2
`
type CheckQuizOwnerParams struct {
ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) CheckQuizOwner(ctx context.Context, arg CheckQuizOwnerParams) (string, error) {
row := q.db.QueryRowContext(ctx, checkQuizOwner, arg.ID, arg.Accountid)
var accountid string
err := row.Scan(&accountid)
return accountid, err
}
const checkResultOwner = `-- name: CheckResultOwner :one
SELECT q.accountid FROM answer a JOIN quiz q ON a.quiz_id = q.id WHERE a.id = $1 AND a.deleted = FALSE AND a.start = false
`
@ -3973,36 +4022,3 @@ func (q *Queries) WorkerTimeoutProcess(ctx context.Context) error {
_, err := q.db.ExecContext(ctx, workerTimeoutProcess)
return err
}
const checkQuestionOwner = `-- name: CheckQuestionOwner :one
SELECT qz.accountid FROM question q
JOIN quiz qz ON q.quiz_id = qz.id WHERE q.id = $1 AND qz.accountid = $2
`
type CheckQuestionOwnerParams struct {
ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) CheckQuestionOwner(ctx context.Context, arg CheckQuestionOwnerParams) (string, error) {
row := q.db.QueryRowContext(ctx, checkQuestionOwner, arg.ID, arg.Accountid)
var accountid string
err := row.Scan(&accountid)
return accountid, err
}
const checkQuizOwner = `-- name: CheckQuizOwner :one
SELECT accountid FROM quiz WHERE id = $1 AND accountid = $2
`
type CheckQuizOwnerParams struct {
ID int64 `db:"id" json:"id"`
Accountid string `db:"accountid" json:"accountid"`
}
func (q *Queries) CheckQuizOwner(ctx context.Context, arg CheckQuizOwnerParams) (string, error) {
row := q.db.QueryRowContext(ctx, checkQuizOwner, arg.ID, arg.Accountid)
var accountid string
err := row.Scan(&accountid)
return accountid, err
}