diff --git a/dal/db_query/queries.sql b/dal/db_query/queries.sql index 0b54f8d..6fb8d5c 100644 --- a/dal/db_query/queries.sql +++ b/dal/db_query/queries.sql @@ -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; \ No newline at end of file +-- name: CheckLeadTargetOwner :one +SELECT accountid FROM leadtarget WHERE id = $1 AND accountid = $2; diff --git a/dal/sqlcgen/db.go b/dal/sqlcgen/db.go index 2d00a87..b72fec4 100644 --- a/dal/sqlcgen/db.go +++ b/dal/sqlcgen/db.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.27.0 +// sqlc v1.28.0 package sqlcgen diff --git a/dal/sqlcgen/models.go b/dal/sqlcgen/models.go index e6430ff..7874091 100644 --- a/dal/sqlcgen/models.go +++ b/dal/sqlcgen/models.go @@ -1,6 +1,6 @@ // Code generated by sqlc. DO NOT EDIT. // versions: -// sqlc v1.27.0 +// sqlc v1.28.0 package sqlcgen diff --git a/dal/sqlcgen/queries.sql.go b/dal/sqlcgen/queries.sql.go index c747912..b2af9b0 100644 --- a/dal/sqlcgen/queries.sql.go +++ b/dal/sqlcgen/queries.sql.go @@ -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 -} \ No newline at end of file