613 lines
19 KiB
Go
613 lines
19 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: cadastro_fot.sql
|
|
|
|
package generated
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const createCadastroFot = `-- name: CreateCadastroFot :one
|
|
INSERT INTO cadastro_fot (
|
|
fot, empresa_id, curso_id, ano_formatura_id, instituicao, cidade, estado, observacoes, gastos_captacao, pre_venda, regiao
|
|
) VALUES (
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11
|
|
)
|
|
ON CONFLICT (fot) DO UPDATE SET
|
|
empresa_id = EXCLUDED.empresa_id,
|
|
curso_id = EXCLUDED.curso_id,
|
|
ano_formatura_id = EXCLUDED.ano_formatura_id,
|
|
instituicao = EXCLUDED.instituicao,
|
|
cidade = EXCLUDED.cidade,
|
|
estado = EXCLUDED.estado,
|
|
observacoes = EXCLUDED.observacoes,
|
|
gastos_captacao = EXCLUDED.gastos_captacao,
|
|
pre_venda = EXCLUDED.pre_venda,
|
|
regiao = EXCLUDED.regiao,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
RETURNING id, fot, empresa_id, curso_id, ano_formatura_id, instituicao, cidade, estado, observacoes, gastos_captacao, pre_venda, created_at, updated_at, regiao, finalizada
|
|
`
|
|
|
|
type CreateCadastroFotParams struct {
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) CreateCadastroFot(ctx context.Context, arg CreateCadastroFotParams) (CadastroFot, error) {
|
|
row := q.db.QueryRow(ctx, createCadastroFot,
|
|
arg.Fot,
|
|
arg.EmpresaID,
|
|
arg.CursoID,
|
|
arg.AnoFormaturaID,
|
|
arg.Instituicao,
|
|
arg.Cidade,
|
|
arg.Estado,
|
|
arg.Observacoes,
|
|
arg.GastosCaptacao,
|
|
arg.PreVenda,
|
|
arg.Regiao,
|
|
)
|
|
var i CadastroFot
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const deleteCadastroFot = `-- name: DeleteCadastroFot :exec
|
|
DELETE FROM cadastro_fot WHERE id = $1 AND regiao = $2
|
|
`
|
|
|
|
type DeleteCadastroFotParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) DeleteCadastroFot(ctx context.Context, arg DeleteCadastroFotParams) error {
|
|
_, err := q.db.Exec(ctx, deleteCadastroFot, arg.ID, arg.Regiao)
|
|
return err
|
|
}
|
|
|
|
const getCadastroFotByFOT = `-- name: GetCadastroFotByFOT :one
|
|
SELECT id, fot, empresa_id, curso_id, ano_formatura_id, instituicao, cidade, estado, observacoes, gastos_captacao, pre_venda, created_at, updated_at, regiao, finalizada FROM cadastro_fot WHERE fot = $1 AND regiao = $2
|
|
`
|
|
|
|
type GetCadastroFotByFOTParams struct {
|
|
Fot string `json:"fot"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) GetCadastroFotByFOT(ctx context.Context, arg GetCadastroFotByFOTParams) (CadastroFot, error) {
|
|
row := q.db.QueryRow(ctx, getCadastroFotByFOT, arg.Fot, arg.Regiao)
|
|
var i CadastroFot
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getCadastroFotByFotJoin = `-- name: GetCadastroFotByFotJoin :one
|
|
SELECT
|
|
c.id, c.fot, c.empresa_id, c.curso_id, c.ano_formatura_id, c.instituicao, c.cidade, c.estado, c.observacoes, c.gastos_captacao, c.pre_venda, c.created_at, c.updated_at, c.regiao, c.finalizada,
|
|
COALESCE(e.nome, '') as empresa_nome,
|
|
COALESCE(cur.nome, '') as curso_nome,
|
|
COALESCE(a.ano_semestre, '') as ano_formatura_label
|
|
FROM cadastro_fot c
|
|
LEFT JOIN empresas e ON c.empresa_id = e.id
|
|
LEFT JOIN cursos cur ON c.curso_id = cur.id
|
|
LEFT JOIN anos_formaturas a ON c.ano_formatura_id = a.id
|
|
WHERE c.fot = $1 AND c.regiao = $2
|
|
`
|
|
|
|
type GetCadastroFotByFotJoinParams struct {
|
|
Fot string `json:"fot"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
type GetCadastroFotByFotJoinRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
CursoNome string `json:"curso_nome"`
|
|
AnoFormaturaLabel string `json:"ano_formatura_label"`
|
|
}
|
|
|
|
func (q *Queries) GetCadastroFotByFotJoin(ctx context.Context, arg GetCadastroFotByFotJoinParams) (GetCadastroFotByFotJoinRow, error) {
|
|
row := q.db.QueryRow(ctx, getCadastroFotByFotJoin, arg.Fot, arg.Regiao)
|
|
var i GetCadastroFotByFotJoinRow
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
&i.EmpresaNome,
|
|
&i.CursoNome,
|
|
&i.AnoFormaturaLabel,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getCadastroFotByID = `-- name: GetCadastroFotByID :one
|
|
SELECT
|
|
c.id, c.fot, c.empresa_id, c.curso_id, c.ano_formatura_id, c.instituicao, c.cidade, c.estado, c.observacoes, c.gastos_captacao, c.pre_venda, c.created_at, c.updated_at, c.regiao, c.finalizada,
|
|
COALESCE(e.nome, '') as empresa_nome,
|
|
COALESCE(cur.nome, '') as curso_nome,
|
|
COALESCE(a.ano_semestre, '') as ano_formatura_label
|
|
FROM cadastro_fot c
|
|
LEFT JOIN empresas e ON c.empresa_id = e.id
|
|
LEFT JOIN cursos cur ON c.curso_id = cur.id
|
|
LEFT JOIN anos_formaturas a ON c.ano_formatura_id = a.id
|
|
WHERE c.id = $1 AND c.regiao = $2
|
|
`
|
|
|
|
type GetCadastroFotByIDParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
type GetCadastroFotByIDRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
CursoNome string `json:"curso_nome"`
|
|
AnoFormaturaLabel string `json:"ano_formatura_label"`
|
|
}
|
|
|
|
func (q *Queries) GetCadastroFotByID(ctx context.Context, arg GetCadastroFotByIDParams) (GetCadastroFotByIDRow, error) {
|
|
row := q.db.QueryRow(ctx, getCadastroFotByID, arg.ID, arg.Regiao)
|
|
var i GetCadastroFotByIDRow
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
&i.EmpresaNome,
|
|
&i.CursoNome,
|
|
&i.AnoFormaturaLabel,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const listCadastroFot = `-- name: ListCadastroFot :many
|
|
SELECT
|
|
c.id, c.fot, c.empresa_id, c.curso_id, c.ano_formatura_id, c.instituicao, c.cidade, c.estado, c.observacoes, c.gastos_captacao, c.pre_venda, c.created_at, c.updated_at, c.regiao, c.finalizada,
|
|
COALESCE(e.nome, '') as empresa_nome,
|
|
COALESCE(cur.nome, '') as curso_nome,
|
|
COALESCE(a.ano_semestre, '') as ano_formatura_label
|
|
FROM cadastro_fot c
|
|
LEFT JOIN empresas e ON c.empresa_id = e.id
|
|
LEFT JOIN cursos cur ON c.curso_id = cur.id
|
|
LEFT JOIN anos_formaturas a ON c.ano_formatura_id = a.id
|
|
WHERE c.regiao = $1
|
|
ORDER BY c.updated_at DESC
|
|
`
|
|
|
|
type ListCadastroFotRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
CursoNome string `json:"curso_nome"`
|
|
AnoFormaturaLabel string `json:"ano_formatura_label"`
|
|
}
|
|
|
|
func (q *Queries) ListCadastroFot(ctx context.Context, regiao pgtype.Text) ([]ListCadastroFotRow, error) {
|
|
rows, err := q.db.Query(ctx, listCadastroFot, regiao)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListCadastroFotRow
|
|
for rows.Next() {
|
|
var i ListCadastroFotRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
&i.EmpresaNome,
|
|
&i.CursoNome,
|
|
&i.AnoFormaturaLabel,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listCadastroFotByEmpresa = `-- name: ListCadastroFotByEmpresa :many
|
|
SELECT
|
|
c.id, c.fot, c.empresa_id, c.curso_id, c.ano_formatura_id, c.instituicao, c.cidade, c.estado, c.observacoes, c.gastos_captacao, c.pre_venda, c.created_at, c.updated_at, c.regiao, c.finalizada,
|
|
COALESCE(e.nome, '') as empresa_nome,
|
|
COALESCE(cur.nome, '') as curso_nome,
|
|
COALESCE(a.ano_semestre, '') as ano_formatura_label
|
|
FROM cadastro_fot c
|
|
LEFT JOIN empresas e ON c.empresa_id = e.id
|
|
LEFT JOIN cursos cur ON c.curso_id = cur.id
|
|
LEFT JOIN anos_formaturas a ON c.ano_formatura_id = a.id
|
|
WHERE c.empresa_id = $1 AND c.regiao = $2
|
|
ORDER BY c.updated_at DESC
|
|
`
|
|
|
|
type ListCadastroFotByEmpresaParams struct {
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
type ListCadastroFotByEmpresaRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
CursoNome string `json:"curso_nome"`
|
|
AnoFormaturaLabel string `json:"ano_formatura_label"`
|
|
}
|
|
|
|
func (q *Queries) ListCadastroFotByEmpresa(ctx context.Context, arg ListCadastroFotByEmpresaParams) ([]ListCadastroFotByEmpresaRow, error) {
|
|
rows, err := q.db.Query(ctx, listCadastroFotByEmpresa, arg.EmpresaID, arg.Regiao)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListCadastroFotByEmpresaRow
|
|
for rows.Next() {
|
|
var i ListCadastroFotByEmpresaRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
&i.EmpresaNome,
|
|
&i.CursoNome,
|
|
&i.AnoFormaturaLabel,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const searchFot = `-- name: SearchFot :many
|
|
SELECT
|
|
c.id, c.fot, c.empresa_id, c.curso_id, c.ano_formatura_id, c.instituicao, c.cidade, c.estado, c.observacoes, c.gastos_captacao, c.pre_venda, c.created_at, c.updated_at, c.regiao, c.finalizada,
|
|
COALESCE(e.nome, '') as empresa_nome,
|
|
COALESCE(cur.nome, '') as curso_nome,
|
|
COALESCE(a.ano_semestre, '') as ano_formatura_label
|
|
FROM cadastro_fot c
|
|
LEFT JOIN empresas e ON c.empresa_id = e.id
|
|
LEFT JOIN cursos cur ON c.curso_id = cur.id
|
|
LEFT JOIN anos_formaturas a ON c.ano_formatura_id = a.id
|
|
WHERE CAST(c.fot AS TEXT) ILIKE '%' || $1 || '%' AND c.regiao = $2
|
|
ORDER BY c.fot ASC
|
|
LIMIT 10
|
|
`
|
|
|
|
type SearchFotParams struct {
|
|
Column1 pgtype.Text `json:"column_1"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
type SearchFotRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CreatedAt pgtype.Timestamptz `json:"created_at"`
|
|
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
CursoNome string `json:"curso_nome"`
|
|
AnoFormaturaLabel string `json:"ano_formatura_label"`
|
|
}
|
|
|
|
func (q *Queries) SearchFot(ctx context.Context, arg SearchFotParams) ([]SearchFotRow, error) {
|
|
rows, err := q.db.Query(ctx, searchFot, arg.Column1, arg.Regiao)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []SearchFotRow
|
|
for rows.Next() {
|
|
var i SearchFotRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
&i.EmpresaNome,
|
|
&i.CursoNome,
|
|
&i.AnoFormaturaLabel,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const toggleFinalizada = `-- name: ToggleFinalizada :one
|
|
UPDATE cadastro_fot
|
|
SET finalizada = $2
|
|
WHERE id = $1 AND regiao = $3
|
|
RETURNING id, fot, empresa_id, curso_id, ano_formatura_id, instituicao, cidade, estado, observacoes, gastos_captacao, pre_venda, created_at, updated_at, regiao, finalizada
|
|
`
|
|
|
|
type ToggleFinalizadaParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Finalizada pgtype.Bool `json:"finalizada"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) ToggleFinalizada(ctx context.Context, arg ToggleFinalizadaParams) (CadastroFot, error) {
|
|
row := q.db.QueryRow(ctx, toggleFinalizada, arg.ID, arg.Finalizada, arg.Regiao)
|
|
var i CadastroFot
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateCadastroFot = `-- name: UpdateCadastroFot :one
|
|
UPDATE cadastro_fot SET
|
|
fot = $2,
|
|
empresa_id = $3,
|
|
curso_id = $4,
|
|
ano_formatura_id = $5,
|
|
instituicao = $6,
|
|
cidade = $7,
|
|
estado = $8,
|
|
observacoes = $9,
|
|
gastos_captacao = $10,
|
|
pre_venda = $11,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id = $1 AND regiao = $12
|
|
RETURNING id, fot, empresa_id, curso_id, ano_formatura_id, instituicao, cidade, estado, observacoes, gastos_captacao, pre_venda, created_at, updated_at, regiao, finalizada
|
|
`
|
|
|
|
type UpdateCadastroFotParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Fot string `json:"fot"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
CursoID pgtype.UUID `json:"curso_id"`
|
|
AnoFormaturaID pgtype.UUID `json:"ano_formatura_id"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Estado pgtype.Text `json:"estado"`
|
|
Observacoes pgtype.Text `json:"observacoes"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) UpdateCadastroFot(ctx context.Context, arg UpdateCadastroFotParams) (CadastroFot, error) {
|
|
row := q.db.QueryRow(ctx, updateCadastroFot,
|
|
arg.ID,
|
|
arg.Fot,
|
|
arg.EmpresaID,
|
|
arg.CursoID,
|
|
arg.AnoFormaturaID,
|
|
arg.Instituicao,
|
|
arg.Cidade,
|
|
arg.Estado,
|
|
arg.Observacoes,
|
|
arg.GastosCaptacao,
|
|
arg.PreVenda,
|
|
arg.Regiao,
|
|
)
|
|
var i CadastroFot
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Fot,
|
|
&i.EmpresaID,
|
|
&i.CursoID,
|
|
&i.AnoFormaturaID,
|
|
&i.Instituicao,
|
|
&i.Cidade,
|
|
&i.Estado,
|
|
&i.Observacoes,
|
|
&i.GastosCaptacao,
|
|
&i.PreVenda,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
&i.Regiao,
|
|
&i.Finalizada,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateCadastroFotGastos = `-- name: UpdateCadastroFotGastos :exec
|
|
UPDATE cadastro_fot SET
|
|
gastos_captacao = $2,
|
|
updated_at = CURRENT_TIMESTAMP
|
|
WHERE id = $1 AND regiao = $3
|
|
`
|
|
|
|
type UpdateCadastroFotGastosParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
GastosCaptacao pgtype.Numeric `json:"gastos_captacao"`
|
|
Regiao pgtype.Text `json:"regiao"`
|
|
}
|
|
|
|
func (q *Queries) UpdateCadastroFotGastos(ctx context.Context, arg UpdateCadastroFotGastosParams) error {
|
|
_, err := q.db.Exec(ctx, updateCadastroFotGastos, arg.ID, arg.GastosCaptacao, arg.Regiao)
|
|
return err
|
|
}
|