Backend: - Migration 007: alterada coluna `fot` de INTEGER para VARCHAR(50). - Ajustados serviços (finance, agenda) e handlers para processar FOT como string. - Regenerados modelos e queries do banco de dados (sqlc). Frontend: - [FotForm](cci:1://file:///c:/Projetos/photum/frontend/components/FotForm.tsx:13:0-348:2): Permitido input de texto/alfanumérico (ex: "20000MG"). - [EventTable](cci:1://file:///c:/Projetos/photum/frontend/components/EventTable.tsx:29:0-684:2): Removido bloqueio do botão "Aprovar" para equipes incompletas. - [Dashboard](cci:1://file:///c:/Projetos/photum/frontend/pages/Dashboard.tsx:31:0-1749:2): Corrigida duplicação do campo "Qtd Formandos". - [Dashboard](cci:1://file:///c:/Projetos/photum/frontend/pages/Dashboard.tsx:31:0-1749:2): Filtros de "Gerenciar Equipe" agora usam funções dinâmicas (IDs) em vez de valores fixos. - `Navbar`: Logo agora redireciona corretamente para `/painel`.
1044 lines
35 KiB
Go
1044 lines
35 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: agenda.sql
|
|
|
|
package generated
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const assignProfessional = `-- name: AssignProfessional :exec
|
|
INSERT INTO agenda_profissionais (agenda_id, profissional_id, funcao_id)
|
|
VALUES ($1, $2, $3)
|
|
ON CONFLICT (agenda_id, profissional_id) DO UPDATE
|
|
SET funcao_id = EXCLUDED.funcao_id
|
|
`
|
|
|
|
type AssignProfessionalParams struct {
|
|
AgendaID pgtype.UUID `json:"agenda_id"`
|
|
ProfissionalID pgtype.UUID `json:"profissional_id"`
|
|
FuncaoID pgtype.UUID `json:"funcao_id"`
|
|
}
|
|
|
|
func (q *Queries) AssignProfessional(ctx context.Context, arg AssignProfessionalParams) error {
|
|
_, err := q.db.Exec(ctx, assignProfessional, arg.AgendaID, arg.ProfissionalID, arg.FuncaoID)
|
|
return err
|
|
}
|
|
|
|
const checkProfessionalBusyDate = `-- name: CheckProfessionalBusyDate :many
|
|
SELECT a.id, a.horario, ap.status
|
|
FROM agenda_profissionais ap
|
|
JOIN agenda a ON ap.agenda_id = a.id
|
|
WHERE ap.profissional_id = $1
|
|
AND a.data_evento = $2
|
|
AND ap.status = 'ACEITO'
|
|
AND a.id != $3
|
|
`
|
|
|
|
type CheckProfessionalBusyDateParams struct {
|
|
ProfissionalID pgtype.UUID `json:"profissional_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
ID pgtype.UUID `json:"id"`
|
|
}
|
|
|
|
type CheckProfessionalBusyDateRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
Status pgtype.Text `json:"status"`
|
|
}
|
|
|
|
func (q *Queries) CheckProfessionalBusyDate(ctx context.Context, arg CheckProfessionalBusyDateParams) ([]CheckProfessionalBusyDateRow, error) {
|
|
rows, err := q.db.Query(ctx, checkProfessionalBusyDate, arg.ProfissionalID, arg.DataEvento, arg.ID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []CheckProfessionalBusyDateRow
|
|
for rows.Next() {
|
|
var i CheckProfessionalBusyDateRow
|
|
if err := rows.Scan(&i.ID, &i.Horario, &i.Status); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const createAgenda = `-- name: CreateAgenda :one
|
|
INSERT INTO agenda (
|
|
fot_id,
|
|
data_evento,
|
|
tipo_evento_id,
|
|
observacoes_evento,
|
|
local_evento,
|
|
endereco,
|
|
horario,
|
|
qtd_formandos,
|
|
qtd_fotografos,
|
|
qtd_recepcionistas,
|
|
qtd_cinegrafistas,
|
|
qtd_estudios,
|
|
qtd_ponto_foto,
|
|
qtd_ponto_id,
|
|
qtd_ponto_decorado,
|
|
qtd_pontos_led,
|
|
qtd_plataforma_360,
|
|
status_profissionais,
|
|
foto_faltante,
|
|
recep_faltante,
|
|
cine_faltante,
|
|
logistica_observacoes,
|
|
pre_venda,
|
|
user_id
|
|
) VALUES (
|
|
$1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24
|
|
) RETURNING id, user_id, fot_id, data_evento, tipo_evento_id, observacoes_evento, local_evento, endereco, horario, qtd_formandos, qtd_fotografos, qtd_recepcionistas, qtd_cinegrafistas, qtd_estudios, qtd_ponto_foto, qtd_ponto_id, qtd_ponto_decorado, qtd_pontos_led, qtd_plataforma_360, status_profissionais, foto_faltante, recep_faltante, cine_faltante, logistica_observacoes, pre_venda, criado_em, atualizado_em, status
|
|
`
|
|
|
|
type CreateAgendaParams struct {
|
|
FotID pgtype.UUID `json:"fot_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
TipoEventoID pgtype.UUID `json:"tipo_evento_id"`
|
|
ObservacoesEvento pgtype.Text `json:"observacoes_evento"`
|
|
LocalEvento pgtype.Text `json:"local_evento"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
QtdFormandos pgtype.Int4 `json:"qtd_formandos"`
|
|
QtdFotografos pgtype.Int4 `json:"qtd_fotografos"`
|
|
QtdRecepcionistas pgtype.Int4 `json:"qtd_recepcionistas"`
|
|
QtdCinegrafistas pgtype.Int4 `json:"qtd_cinegrafistas"`
|
|
QtdEstudios pgtype.Int4 `json:"qtd_estudios"`
|
|
QtdPontoFoto pgtype.Int4 `json:"qtd_ponto_foto"`
|
|
QtdPontoID pgtype.Int4 `json:"qtd_ponto_id"`
|
|
QtdPontoDecorado pgtype.Int4 `json:"qtd_ponto_decorado"`
|
|
QtdPontosLed pgtype.Int4 `json:"qtd_pontos_led"`
|
|
QtdPlataforma360 pgtype.Int4 `json:"qtd_plataforma_360"`
|
|
StatusProfissionais pgtype.Text `json:"status_profissionais"`
|
|
FotoFaltante pgtype.Int4 `json:"foto_faltante"`
|
|
RecepFaltante pgtype.Int4 `json:"recep_faltante"`
|
|
CineFaltante pgtype.Int4 `json:"cine_faltante"`
|
|
LogisticaObservacoes pgtype.Text `json:"logistica_observacoes"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
}
|
|
|
|
func (q *Queries) CreateAgenda(ctx context.Context, arg CreateAgendaParams) (Agenda, error) {
|
|
row := q.db.QueryRow(ctx, createAgenda,
|
|
arg.FotID,
|
|
arg.DataEvento,
|
|
arg.TipoEventoID,
|
|
arg.ObservacoesEvento,
|
|
arg.LocalEvento,
|
|
arg.Endereco,
|
|
arg.Horario,
|
|
arg.QtdFormandos,
|
|
arg.QtdFotografos,
|
|
arg.QtdRecepcionistas,
|
|
arg.QtdCinegrafistas,
|
|
arg.QtdEstudios,
|
|
arg.QtdPontoFoto,
|
|
arg.QtdPontoID,
|
|
arg.QtdPontoDecorado,
|
|
arg.QtdPontosLed,
|
|
arg.QtdPlataforma360,
|
|
arg.StatusProfissionais,
|
|
arg.FotoFaltante,
|
|
arg.RecepFaltante,
|
|
arg.CineFaltante,
|
|
arg.LogisticaObservacoes,
|
|
arg.PreVenda,
|
|
arg.UserID,
|
|
)
|
|
var i Agenda
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const deleteAgenda = `-- name: DeleteAgenda :exec
|
|
DELETE FROM agenda
|
|
WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) DeleteAgenda(ctx context.Context, id pgtype.UUID) error {
|
|
_, err := q.db.Exec(ctx, deleteAgenda, id)
|
|
return err
|
|
}
|
|
|
|
const getAgenda = `-- name: GetAgenda :one
|
|
SELECT id, user_id, fot_id, data_evento, tipo_evento_id, observacoes_evento, local_evento, endereco, horario, qtd_formandos, qtd_fotografos, qtd_recepcionistas, qtd_cinegrafistas, qtd_estudios, qtd_ponto_foto, qtd_ponto_id, qtd_ponto_decorado, qtd_pontos_led, qtd_plataforma_360, status_profissionais, foto_faltante, recep_faltante, cine_faltante, logistica_observacoes, pre_venda, criado_em, atualizado_em, status FROM agenda
|
|
WHERE id = $1 LIMIT 1
|
|
`
|
|
|
|
func (q *Queries) GetAgenda(ctx context.Context, id pgtype.UUID) (Agenda, error) {
|
|
row := q.db.QueryRow(ctx, getAgenda, id)
|
|
var i Agenda
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getAgendaProfessionals = `-- name: GetAgendaProfessionals :many
|
|
SELECT p.id, p.usuario_id, p.nome, p.funcao_profissional_id, p.endereco, p.cidade, p.uf, p.whatsapp, p.cpf_cnpj_titular, p.banco, p.agencia, p.conta_pix, p.carro_disponivel, p.tem_estudio, p.qtd_estudio, p.tipo_cartao, p.observacao, p.qual_tec, p.educacao_simpatia, p.desempenho_evento, p.disp_horario, p.media, p.tabela_free, p.extra_por_equipamento, p.equipamentos, p.email, p.avatar_url, p.criado_em, p.atualizado_em, f.nome as funcao_nome, u.email
|
|
FROM cadastro_profissionais p
|
|
JOIN agenda_profissionais ap ON p.id = ap.profissional_id
|
|
LEFT JOIN funcoes_profissionais f ON p.funcao_profissional_id = f.id
|
|
LEFT JOIN usuarios u ON p.usuario_id = u.id
|
|
WHERE ap.agenda_id = $1
|
|
`
|
|
|
|
type GetAgendaProfessionalsRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UsuarioID pgtype.UUID `json:"usuario_id"`
|
|
Nome string `json:"nome"`
|
|
FuncaoProfissionalID pgtype.UUID `json:"funcao_profissional_id"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Uf pgtype.Text `json:"uf"`
|
|
Whatsapp pgtype.Text `json:"whatsapp"`
|
|
CpfCnpjTitular pgtype.Text `json:"cpf_cnpj_titular"`
|
|
Banco pgtype.Text `json:"banco"`
|
|
Agencia pgtype.Text `json:"agencia"`
|
|
ContaPix pgtype.Text `json:"conta_pix"`
|
|
CarroDisponivel pgtype.Bool `json:"carro_disponivel"`
|
|
TemEstudio pgtype.Bool `json:"tem_estudio"`
|
|
QtdEstudio pgtype.Int4 `json:"qtd_estudio"`
|
|
TipoCartao pgtype.Text `json:"tipo_cartao"`
|
|
Observacao pgtype.Text `json:"observacao"`
|
|
QualTec pgtype.Int4 `json:"qual_tec"`
|
|
EducacaoSimpatia pgtype.Int4 `json:"educacao_simpatia"`
|
|
DesempenhoEvento pgtype.Int4 `json:"desempenho_evento"`
|
|
DispHorario pgtype.Int4 `json:"disp_horario"`
|
|
Media pgtype.Numeric `json:"media"`
|
|
TabelaFree pgtype.Text `json:"tabela_free"`
|
|
ExtraPorEquipamento pgtype.Bool `json:"extra_por_equipamento"`
|
|
Equipamentos pgtype.Text `json:"equipamentos"`
|
|
Email pgtype.Text `json:"email"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
CriadoEm pgtype.Timestamptz `json:"criado_em"`
|
|
AtualizadoEm pgtype.Timestamptz `json:"atualizado_em"`
|
|
FuncaoNome pgtype.Text `json:"funcao_nome"`
|
|
Email_2 pgtype.Text `json:"email_2"`
|
|
}
|
|
|
|
func (q *Queries) GetAgendaProfessionals(ctx context.Context, agendaID pgtype.UUID) ([]GetAgendaProfessionalsRow, error) {
|
|
rows, err := q.db.Query(ctx, getAgendaProfessionals, agendaID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []GetAgendaProfessionalsRow
|
|
for rows.Next() {
|
|
var i GetAgendaProfessionalsRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UsuarioID,
|
|
&i.Nome,
|
|
&i.FuncaoProfissionalID,
|
|
&i.Endereco,
|
|
&i.Cidade,
|
|
&i.Uf,
|
|
&i.Whatsapp,
|
|
&i.CpfCnpjTitular,
|
|
&i.Banco,
|
|
&i.Agencia,
|
|
&i.ContaPix,
|
|
&i.CarroDisponivel,
|
|
&i.TemEstudio,
|
|
&i.QtdEstudio,
|
|
&i.TipoCartao,
|
|
&i.Observacao,
|
|
&i.QualTec,
|
|
&i.EducacaoSimpatia,
|
|
&i.DesempenhoEvento,
|
|
&i.DispHorario,
|
|
&i.Media,
|
|
&i.TabelaFree,
|
|
&i.ExtraPorEquipamento,
|
|
&i.Equipamentos,
|
|
&i.Email,
|
|
&i.AvatarUrl,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.FuncaoNome,
|
|
&i.Email_2,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listAgendas = `-- name: ListAgendas :many
|
|
SELECT
|
|
a.id, a.user_id, a.fot_id, a.data_evento, a.tipo_evento_id, a.observacoes_evento, a.local_evento, a.endereco, a.horario, a.qtd_formandos, a.qtd_fotografos, a.qtd_recepcionistas, a.qtd_cinegrafistas, a.qtd_estudios, a.qtd_ponto_foto, a.qtd_ponto_id, a.qtd_ponto_decorado, a.qtd_pontos_led, a.qtd_plataforma_360, a.status_profissionais, a.foto_faltante, a.recep_faltante, a.cine_faltante, a.logistica_observacoes, a.pre_venda, a.criado_em, a.atualizado_em, a.status,
|
|
cf.fot as fot_numero,
|
|
cf.instituicao,
|
|
c.nome as curso_nome,
|
|
e.nome as empresa_nome,
|
|
af.ano_semestre,
|
|
cf.observacoes as observacoes_fot,
|
|
te.nome as tipo_evento_nome,
|
|
cf.empresa_id,
|
|
COALESCE(
|
|
(SELECT json_agg(json_build_object(
|
|
'professional_id', ap.profissional_id,
|
|
'status', ap.status,
|
|
'motivo_rejeicao', ap.motivo_rejeicao,
|
|
'funcao_id', ap.funcao_id
|
|
))
|
|
FROM agenda_profissionais ap
|
|
WHERE ap.agenda_id = a.id),
|
|
'[]'::json
|
|
) as assigned_professionals
|
|
FROM agenda a
|
|
JOIN cadastro_fot cf ON a.fot_id = cf.id
|
|
JOIN cursos c ON cf.curso_id = c.id
|
|
JOIN empresas e ON cf.empresa_id = e.id
|
|
JOIN anos_formaturas af ON cf.ano_formatura_id = af.id
|
|
JOIN tipos_eventos te ON a.tipo_evento_id = te.id
|
|
ORDER BY a.data_evento
|
|
`
|
|
|
|
type ListAgendasRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
FotID pgtype.UUID `json:"fot_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
TipoEventoID pgtype.UUID `json:"tipo_evento_id"`
|
|
ObservacoesEvento pgtype.Text `json:"observacoes_evento"`
|
|
LocalEvento pgtype.Text `json:"local_evento"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
QtdFormandos pgtype.Int4 `json:"qtd_formandos"`
|
|
QtdFotografos pgtype.Int4 `json:"qtd_fotografos"`
|
|
QtdRecepcionistas pgtype.Int4 `json:"qtd_recepcionistas"`
|
|
QtdCinegrafistas pgtype.Int4 `json:"qtd_cinegrafistas"`
|
|
QtdEstudios pgtype.Int4 `json:"qtd_estudios"`
|
|
QtdPontoFoto pgtype.Int4 `json:"qtd_ponto_foto"`
|
|
QtdPontoID pgtype.Int4 `json:"qtd_ponto_id"`
|
|
QtdPontoDecorado pgtype.Int4 `json:"qtd_ponto_decorado"`
|
|
QtdPontosLed pgtype.Int4 `json:"qtd_pontos_led"`
|
|
QtdPlataforma360 pgtype.Int4 `json:"qtd_plataforma_360"`
|
|
StatusProfissionais pgtype.Text `json:"status_profissionais"`
|
|
FotoFaltante pgtype.Int4 `json:"foto_faltante"`
|
|
RecepFaltante pgtype.Int4 `json:"recep_faltante"`
|
|
CineFaltante pgtype.Int4 `json:"cine_faltante"`
|
|
LogisticaObservacoes pgtype.Text `json:"logistica_observacoes"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CriadoEm pgtype.Timestamptz `json:"criado_em"`
|
|
AtualizadoEm pgtype.Timestamptz `json:"atualizado_em"`
|
|
Status pgtype.Text `json:"status"`
|
|
FotNumero string `json:"fot_numero"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
CursoNome string `json:"curso_nome"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
AnoSemestre string `json:"ano_semestre"`
|
|
ObservacoesFot pgtype.Text `json:"observacoes_fot"`
|
|
TipoEventoNome string `json:"tipo_evento_nome"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
AssignedProfessionals interface{} `json:"assigned_professionals"`
|
|
}
|
|
|
|
func (q *Queries) ListAgendas(ctx context.Context) ([]ListAgendasRow, error) {
|
|
rows, err := q.db.Query(ctx, listAgendas)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListAgendasRow
|
|
for rows.Next() {
|
|
var i ListAgendasRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
&i.FotNumero,
|
|
&i.Instituicao,
|
|
&i.CursoNome,
|
|
&i.EmpresaNome,
|
|
&i.AnoSemestre,
|
|
&i.ObservacoesFot,
|
|
&i.TipoEventoNome,
|
|
&i.EmpresaID,
|
|
&i.AssignedProfessionals,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listAgendasByFot = `-- name: ListAgendasByFot :many
|
|
SELECT
|
|
a.id, a.user_id, a.fot_id, a.data_evento, a.tipo_evento_id, a.observacoes_evento, a.local_evento, a.endereco, a.horario, a.qtd_formandos, a.qtd_fotografos, a.qtd_recepcionistas, a.qtd_cinegrafistas, a.qtd_estudios, a.qtd_ponto_foto, a.qtd_ponto_id, a.qtd_ponto_decorado, a.qtd_pontos_led, a.qtd_plataforma_360, a.status_profissionais, a.foto_faltante, a.recep_faltante, a.cine_faltante, a.logistica_observacoes, a.pre_venda, a.criado_em, a.atualizado_em, a.status,
|
|
te.nome as tipo_evento_nome
|
|
FROM agenda a
|
|
JOIN tipos_eventos te ON a.tipo_evento_id = te.id
|
|
WHERE a.fot_id = $1
|
|
ORDER BY a.data_evento
|
|
`
|
|
|
|
type ListAgendasByFotRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
FotID pgtype.UUID `json:"fot_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
TipoEventoID pgtype.UUID `json:"tipo_evento_id"`
|
|
ObservacoesEvento pgtype.Text `json:"observacoes_evento"`
|
|
LocalEvento pgtype.Text `json:"local_evento"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
QtdFormandos pgtype.Int4 `json:"qtd_formandos"`
|
|
QtdFotografos pgtype.Int4 `json:"qtd_fotografos"`
|
|
QtdRecepcionistas pgtype.Int4 `json:"qtd_recepcionistas"`
|
|
QtdCinegrafistas pgtype.Int4 `json:"qtd_cinegrafistas"`
|
|
QtdEstudios pgtype.Int4 `json:"qtd_estudios"`
|
|
QtdPontoFoto pgtype.Int4 `json:"qtd_ponto_foto"`
|
|
QtdPontoID pgtype.Int4 `json:"qtd_ponto_id"`
|
|
QtdPontoDecorado pgtype.Int4 `json:"qtd_ponto_decorado"`
|
|
QtdPontosLed pgtype.Int4 `json:"qtd_pontos_led"`
|
|
QtdPlataforma360 pgtype.Int4 `json:"qtd_plataforma_360"`
|
|
StatusProfissionais pgtype.Text `json:"status_profissionais"`
|
|
FotoFaltante pgtype.Int4 `json:"foto_faltante"`
|
|
RecepFaltante pgtype.Int4 `json:"recep_faltante"`
|
|
CineFaltante pgtype.Int4 `json:"cine_faltante"`
|
|
LogisticaObservacoes pgtype.Text `json:"logistica_observacoes"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CriadoEm pgtype.Timestamptz `json:"criado_em"`
|
|
AtualizadoEm pgtype.Timestamptz `json:"atualizado_em"`
|
|
Status pgtype.Text `json:"status"`
|
|
TipoEventoNome string `json:"tipo_evento_nome"`
|
|
}
|
|
|
|
func (q *Queries) ListAgendasByFot(ctx context.Context, fotID pgtype.UUID) ([]ListAgendasByFotRow, error) {
|
|
rows, err := q.db.Query(ctx, listAgendasByFot, fotID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListAgendasByFotRow
|
|
for rows.Next() {
|
|
var i ListAgendasByFotRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
&i.TipoEventoNome,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listAgendasByUser = `-- name: ListAgendasByUser :many
|
|
SELECT
|
|
a.id, a.user_id, a.fot_id, a.data_evento, a.tipo_evento_id, a.observacoes_evento, a.local_evento, a.endereco, a.horario, a.qtd_formandos, a.qtd_fotografos, a.qtd_recepcionistas, a.qtd_cinegrafistas, a.qtd_estudios, a.qtd_ponto_foto, a.qtd_ponto_id, a.qtd_ponto_decorado, a.qtd_pontos_led, a.qtd_plataforma_360, a.status_profissionais, a.foto_faltante, a.recep_faltante, a.cine_faltante, a.logistica_observacoes, a.pre_venda, a.criado_em, a.atualizado_em, a.status,
|
|
cf.fot as fot_numero,
|
|
cf.instituicao,
|
|
c.nome as curso_nome,
|
|
e.nome as empresa_nome,
|
|
af.ano_semestre,
|
|
cf.observacoes as observacoes_fot,
|
|
te.nome as tipo_evento_nome,
|
|
cf.empresa_id,
|
|
COALESCE(
|
|
(SELECT json_agg(json_build_object(
|
|
'professional_id', ap.profissional_id,
|
|
'status', ap.status,
|
|
'motivo_rejeicao', ap.motivo_rejeicao,
|
|
'funcao_id', ap.funcao_id
|
|
))
|
|
FROM agenda_profissionais ap
|
|
WHERE ap.agenda_id = a.id),
|
|
'[]'::json
|
|
) as assigned_professionals
|
|
FROM agenda a
|
|
JOIN cadastro_fot cf ON a.fot_id = cf.id
|
|
JOIN cursos c ON cf.curso_id = c.id
|
|
JOIN empresas e ON cf.empresa_id = e.id
|
|
JOIN anos_formaturas af ON cf.ano_formatura_id = af.id
|
|
JOIN tipos_eventos te ON a.tipo_evento_id = te.id
|
|
WHERE a.user_id = $1
|
|
ORDER BY a.data_evento
|
|
`
|
|
|
|
type ListAgendasByUserRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UserID pgtype.UUID `json:"user_id"`
|
|
FotID pgtype.UUID `json:"fot_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
TipoEventoID pgtype.UUID `json:"tipo_evento_id"`
|
|
ObservacoesEvento pgtype.Text `json:"observacoes_evento"`
|
|
LocalEvento pgtype.Text `json:"local_evento"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
QtdFormandos pgtype.Int4 `json:"qtd_formandos"`
|
|
QtdFotografos pgtype.Int4 `json:"qtd_fotografos"`
|
|
QtdRecepcionistas pgtype.Int4 `json:"qtd_recepcionistas"`
|
|
QtdCinegrafistas pgtype.Int4 `json:"qtd_cinegrafistas"`
|
|
QtdEstudios pgtype.Int4 `json:"qtd_estudios"`
|
|
QtdPontoFoto pgtype.Int4 `json:"qtd_ponto_foto"`
|
|
QtdPontoID pgtype.Int4 `json:"qtd_ponto_id"`
|
|
QtdPontoDecorado pgtype.Int4 `json:"qtd_ponto_decorado"`
|
|
QtdPontosLed pgtype.Int4 `json:"qtd_pontos_led"`
|
|
QtdPlataforma360 pgtype.Int4 `json:"qtd_plataforma_360"`
|
|
StatusProfissionais pgtype.Text `json:"status_profissionais"`
|
|
FotoFaltante pgtype.Int4 `json:"foto_faltante"`
|
|
RecepFaltante pgtype.Int4 `json:"recep_faltante"`
|
|
CineFaltante pgtype.Int4 `json:"cine_faltante"`
|
|
LogisticaObservacoes pgtype.Text `json:"logistica_observacoes"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
CriadoEm pgtype.Timestamptz `json:"criado_em"`
|
|
AtualizadoEm pgtype.Timestamptz `json:"atualizado_em"`
|
|
Status pgtype.Text `json:"status"`
|
|
FotNumero string `json:"fot_numero"`
|
|
Instituicao pgtype.Text `json:"instituicao"`
|
|
CursoNome string `json:"curso_nome"`
|
|
EmpresaNome string `json:"empresa_nome"`
|
|
AnoSemestre string `json:"ano_semestre"`
|
|
ObservacoesFot pgtype.Text `json:"observacoes_fot"`
|
|
TipoEventoNome string `json:"tipo_evento_nome"`
|
|
EmpresaID pgtype.UUID `json:"empresa_id"`
|
|
AssignedProfessionals interface{} `json:"assigned_professionals"`
|
|
}
|
|
|
|
func (q *Queries) ListAgendasByUser(ctx context.Context, userID pgtype.UUID) ([]ListAgendasByUserRow, error) {
|
|
rows, err := q.db.Query(ctx, listAgendasByUser, userID)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListAgendasByUserRow
|
|
for rows.Next() {
|
|
var i ListAgendasByUserRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
&i.FotNumero,
|
|
&i.Instituicao,
|
|
&i.CursoNome,
|
|
&i.EmpresaNome,
|
|
&i.AnoSemestre,
|
|
&i.ObservacoesFot,
|
|
&i.TipoEventoNome,
|
|
&i.EmpresaID,
|
|
&i.AssignedProfessionals,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const listAvailableProfessionalsForDate = `-- name: ListAvailableProfessionalsForDate :many
|
|
SELECT
|
|
p.id, p.usuario_id, p.nome, p.funcao_profissional_id, p.endereco, p.cidade, p.uf, p.whatsapp, p.cpf_cnpj_titular, p.banco, p.agencia, p.conta_pix, p.carro_disponivel, p.tem_estudio, p.qtd_estudio, p.tipo_cartao, p.observacao, p.qual_tec, p.educacao_simpatia, p.desempenho_evento, p.disp_horario, p.media, p.tabela_free, p.extra_por_equipamento, p.equipamentos, p.email, p.avatar_url, p.criado_em, p.atualizado_em,
|
|
u.email,
|
|
f.nome as funcao_nome,
|
|
dp.status as status_disponibilidade
|
|
FROM cadastro_profissionais p
|
|
JOIN usuarios u ON p.usuario_id = u.id
|
|
JOIN funcoes_profissionais f ON p.funcao_profissional_id = f.id
|
|
JOIN disponibilidade_profissionais dp ON u.id = dp.usuario_id
|
|
WHERE dp.data = $1
|
|
AND dp.status = 'DISPONIVEL'
|
|
AND p.id NOT IN (
|
|
SELECT ap.profissional_id
|
|
FROM agenda_profissionais ap
|
|
JOIN agenda a ON ap.agenda_id = a.id
|
|
WHERE a.data_evento = $1
|
|
AND ap.status = 'ACEITO'
|
|
)
|
|
ORDER BY p.nome
|
|
`
|
|
|
|
type ListAvailableProfessionalsForDateRow struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
UsuarioID pgtype.UUID `json:"usuario_id"`
|
|
Nome string `json:"nome"`
|
|
FuncaoProfissionalID pgtype.UUID `json:"funcao_profissional_id"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Cidade pgtype.Text `json:"cidade"`
|
|
Uf pgtype.Text `json:"uf"`
|
|
Whatsapp pgtype.Text `json:"whatsapp"`
|
|
CpfCnpjTitular pgtype.Text `json:"cpf_cnpj_titular"`
|
|
Banco pgtype.Text `json:"banco"`
|
|
Agencia pgtype.Text `json:"agencia"`
|
|
ContaPix pgtype.Text `json:"conta_pix"`
|
|
CarroDisponivel pgtype.Bool `json:"carro_disponivel"`
|
|
TemEstudio pgtype.Bool `json:"tem_estudio"`
|
|
QtdEstudio pgtype.Int4 `json:"qtd_estudio"`
|
|
TipoCartao pgtype.Text `json:"tipo_cartao"`
|
|
Observacao pgtype.Text `json:"observacao"`
|
|
QualTec pgtype.Int4 `json:"qual_tec"`
|
|
EducacaoSimpatia pgtype.Int4 `json:"educacao_simpatia"`
|
|
DesempenhoEvento pgtype.Int4 `json:"desempenho_evento"`
|
|
DispHorario pgtype.Int4 `json:"disp_horario"`
|
|
Media pgtype.Numeric `json:"media"`
|
|
TabelaFree pgtype.Text `json:"tabela_free"`
|
|
ExtraPorEquipamento pgtype.Bool `json:"extra_por_equipamento"`
|
|
Equipamentos pgtype.Text `json:"equipamentos"`
|
|
Email pgtype.Text `json:"email"`
|
|
AvatarUrl pgtype.Text `json:"avatar_url"`
|
|
CriadoEm pgtype.Timestamptz `json:"criado_em"`
|
|
AtualizadoEm pgtype.Timestamptz `json:"atualizado_em"`
|
|
Email_2 string `json:"email_2"`
|
|
FuncaoNome string `json:"funcao_nome"`
|
|
StatusDisponibilidade string `json:"status_disponibilidade"`
|
|
}
|
|
|
|
func (q *Queries) ListAvailableProfessionalsForDate(ctx context.Context, data pgtype.Date) ([]ListAvailableProfessionalsForDateRow, error) {
|
|
rows, err := q.db.Query(ctx, listAvailableProfessionalsForDate, data)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ListAvailableProfessionalsForDateRow
|
|
for rows.Next() {
|
|
var i ListAvailableProfessionalsForDateRow
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.UsuarioID,
|
|
&i.Nome,
|
|
&i.FuncaoProfissionalID,
|
|
&i.Endereco,
|
|
&i.Cidade,
|
|
&i.Uf,
|
|
&i.Whatsapp,
|
|
&i.CpfCnpjTitular,
|
|
&i.Banco,
|
|
&i.Agencia,
|
|
&i.ContaPix,
|
|
&i.CarroDisponivel,
|
|
&i.TemEstudio,
|
|
&i.QtdEstudio,
|
|
&i.TipoCartao,
|
|
&i.Observacao,
|
|
&i.QualTec,
|
|
&i.EducacaoSimpatia,
|
|
&i.DesempenhoEvento,
|
|
&i.DispHorario,
|
|
&i.Media,
|
|
&i.TabelaFree,
|
|
&i.ExtraPorEquipamento,
|
|
&i.Equipamentos,
|
|
&i.Email,
|
|
&i.AvatarUrl,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Email_2,
|
|
&i.FuncaoNome,
|
|
&i.StatusDisponibilidade,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const removeProfessional = `-- name: RemoveProfessional :exec
|
|
DELETE FROM agenda_profissionais
|
|
WHERE agenda_id = $1 AND profissional_id = $2
|
|
`
|
|
|
|
type RemoveProfessionalParams struct {
|
|
AgendaID pgtype.UUID `json:"agenda_id"`
|
|
ProfissionalID pgtype.UUID `json:"profissional_id"`
|
|
}
|
|
|
|
func (q *Queries) RemoveProfessional(ctx context.Context, arg RemoveProfessionalParams) error {
|
|
_, err := q.db.Exec(ctx, removeProfessional, arg.AgendaID, arg.ProfissionalID)
|
|
return err
|
|
}
|
|
|
|
const updateAgenda = `-- name: UpdateAgenda :one
|
|
UPDATE agenda
|
|
SET
|
|
fot_id = $2,
|
|
data_evento = $3,
|
|
tipo_evento_id = $4,
|
|
observacoes_evento = $5,
|
|
local_evento = $6,
|
|
endereco = $7,
|
|
horario = $8,
|
|
qtd_formandos = $9,
|
|
qtd_fotografos = $10,
|
|
qtd_recepcionistas = $11,
|
|
qtd_cinegrafistas = $12,
|
|
qtd_estudios = $13,
|
|
qtd_ponto_foto = $14,
|
|
qtd_ponto_id = $15,
|
|
qtd_ponto_decorado = $16,
|
|
qtd_pontos_led = $17,
|
|
qtd_plataforma_360 = $18,
|
|
status_profissionais = $19,
|
|
foto_faltante = $20,
|
|
recep_faltante = $21,
|
|
cine_faltante = $22,
|
|
logistica_observacoes = $23,
|
|
pre_venda = $24,
|
|
atualizado_em = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, user_id, fot_id, data_evento, tipo_evento_id, observacoes_evento, local_evento, endereco, horario, qtd_formandos, qtd_fotografos, qtd_recepcionistas, qtd_cinegrafistas, qtd_estudios, qtd_ponto_foto, qtd_ponto_id, qtd_ponto_decorado, qtd_pontos_led, qtd_plataforma_360, status_profissionais, foto_faltante, recep_faltante, cine_faltante, logistica_observacoes, pre_venda, criado_em, atualizado_em, status
|
|
`
|
|
|
|
type UpdateAgendaParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
FotID pgtype.UUID `json:"fot_id"`
|
|
DataEvento pgtype.Date `json:"data_evento"`
|
|
TipoEventoID pgtype.UUID `json:"tipo_evento_id"`
|
|
ObservacoesEvento pgtype.Text `json:"observacoes_evento"`
|
|
LocalEvento pgtype.Text `json:"local_evento"`
|
|
Endereco pgtype.Text `json:"endereco"`
|
|
Horario pgtype.Text `json:"horario"`
|
|
QtdFormandos pgtype.Int4 `json:"qtd_formandos"`
|
|
QtdFotografos pgtype.Int4 `json:"qtd_fotografos"`
|
|
QtdRecepcionistas pgtype.Int4 `json:"qtd_recepcionistas"`
|
|
QtdCinegrafistas pgtype.Int4 `json:"qtd_cinegrafistas"`
|
|
QtdEstudios pgtype.Int4 `json:"qtd_estudios"`
|
|
QtdPontoFoto pgtype.Int4 `json:"qtd_ponto_foto"`
|
|
QtdPontoID pgtype.Int4 `json:"qtd_ponto_id"`
|
|
QtdPontoDecorado pgtype.Int4 `json:"qtd_ponto_decorado"`
|
|
QtdPontosLed pgtype.Int4 `json:"qtd_pontos_led"`
|
|
QtdPlataforma360 pgtype.Int4 `json:"qtd_plataforma_360"`
|
|
StatusProfissionais pgtype.Text `json:"status_profissionais"`
|
|
FotoFaltante pgtype.Int4 `json:"foto_faltante"`
|
|
RecepFaltante pgtype.Int4 `json:"recep_faltante"`
|
|
CineFaltante pgtype.Int4 `json:"cine_faltante"`
|
|
LogisticaObservacoes pgtype.Text `json:"logistica_observacoes"`
|
|
PreVenda pgtype.Bool `json:"pre_venda"`
|
|
}
|
|
|
|
func (q *Queries) UpdateAgenda(ctx context.Context, arg UpdateAgendaParams) (Agenda, error) {
|
|
row := q.db.QueryRow(ctx, updateAgenda,
|
|
arg.ID,
|
|
arg.FotID,
|
|
arg.DataEvento,
|
|
arg.TipoEventoID,
|
|
arg.ObservacoesEvento,
|
|
arg.LocalEvento,
|
|
arg.Endereco,
|
|
arg.Horario,
|
|
arg.QtdFormandos,
|
|
arg.QtdFotografos,
|
|
arg.QtdRecepcionistas,
|
|
arg.QtdCinegrafistas,
|
|
arg.QtdEstudios,
|
|
arg.QtdPontoFoto,
|
|
arg.QtdPontoID,
|
|
arg.QtdPontoDecorado,
|
|
arg.QtdPontosLed,
|
|
arg.QtdPlataforma360,
|
|
arg.StatusProfissionais,
|
|
arg.FotoFaltante,
|
|
arg.RecepFaltante,
|
|
arg.CineFaltante,
|
|
arg.LogisticaObservacoes,
|
|
arg.PreVenda,
|
|
)
|
|
var i Agenda
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateAgendaStatus = `-- name: UpdateAgendaStatus :one
|
|
UPDATE agenda
|
|
SET status = $2, atualizado_em = NOW()
|
|
WHERE id = $1
|
|
RETURNING id, user_id, fot_id, data_evento, tipo_evento_id, observacoes_evento, local_evento, endereco, horario, qtd_formandos, qtd_fotografos, qtd_recepcionistas, qtd_cinegrafistas, qtd_estudios, qtd_ponto_foto, qtd_ponto_id, qtd_ponto_decorado, qtd_pontos_led, qtd_plataforma_360, status_profissionais, foto_faltante, recep_faltante, cine_faltante, logistica_observacoes, pre_venda, criado_em, atualizado_em, status
|
|
`
|
|
|
|
type UpdateAgendaStatusParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
Status pgtype.Text `json:"status"`
|
|
}
|
|
|
|
func (q *Queries) UpdateAgendaStatus(ctx context.Context, arg UpdateAgendaStatusParams) (Agenda, error) {
|
|
row := q.db.QueryRow(ctx, updateAgendaStatus, arg.ID, arg.Status)
|
|
var i Agenda
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.UserID,
|
|
&i.FotID,
|
|
&i.DataEvento,
|
|
&i.TipoEventoID,
|
|
&i.ObservacoesEvento,
|
|
&i.LocalEvento,
|
|
&i.Endereco,
|
|
&i.Horario,
|
|
&i.QtdFormandos,
|
|
&i.QtdFotografos,
|
|
&i.QtdRecepcionistas,
|
|
&i.QtdCinegrafistas,
|
|
&i.QtdEstudios,
|
|
&i.QtdPontoFoto,
|
|
&i.QtdPontoID,
|
|
&i.QtdPontoDecorado,
|
|
&i.QtdPontosLed,
|
|
&i.QtdPlataforma360,
|
|
&i.StatusProfissionais,
|
|
&i.FotoFaltante,
|
|
&i.RecepFaltante,
|
|
&i.CineFaltante,
|
|
&i.LogisticaObservacoes,
|
|
&i.PreVenda,
|
|
&i.CriadoEm,
|
|
&i.AtualizadoEm,
|
|
&i.Status,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateAssignmentPosition = `-- name: UpdateAssignmentPosition :one
|
|
UPDATE agenda_profissionais
|
|
SET posicao = $3
|
|
WHERE agenda_id = $1 AND profissional_id = $2
|
|
RETURNING id, agenda_id, profissional_id, status, motivo_rejeicao, funcao_id, criado_em, posicao
|
|
`
|
|
|
|
type UpdateAssignmentPositionParams struct {
|
|
AgendaID pgtype.UUID `json:"agenda_id"`
|
|
ProfissionalID pgtype.UUID `json:"profissional_id"`
|
|
Posicao pgtype.Text `json:"posicao"`
|
|
}
|
|
|
|
func (q *Queries) UpdateAssignmentPosition(ctx context.Context, arg UpdateAssignmentPositionParams) (AgendaProfissionai, error) {
|
|
row := q.db.QueryRow(ctx, updateAssignmentPosition, arg.AgendaID, arg.ProfissionalID, arg.Posicao)
|
|
var i AgendaProfissionai
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.AgendaID,
|
|
&i.ProfissionalID,
|
|
&i.Status,
|
|
&i.MotivoRejeicao,
|
|
&i.FuncaoID,
|
|
&i.CriadoEm,
|
|
&i.Posicao,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const updateAssignmentStatus = `-- name: UpdateAssignmentStatus :one
|
|
UPDATE agenda_profissionais
|
|
SET status = $3, motivo_rejeicao = $4
|
|
WHERE agenda_id = $1 AND profissional_id = $2
|
|
RETURNING id, agenda_id, profissional_id, status, motivo_rejeicao, funcao_id, criado_em, posicao
|
|
`
|
|
|
|
type UpdateAssignmentStatusParams struct {
|
|
AgendaID pgtype.UUID `json:"agenda_id"`
|
|
ProfissionalID pgtype.UUID `json:"profissional_id"`
|
|
Status pgtype.Text `json:"status"`
|
|
MotivoRejeicao pgtype.Text `json:"motivo_rejeicao"`
|
|
}
|
|
|
|
func (q *Queries) UpdateAssignmentStatus(ctx context.Context, arg UpdateAssignmentStatusParams) (AgendaProfissionai, error) {
|
|
row := q.db.QueryRow(ctx, updateAssignmentStatus,
|
|
arg.AgendaID,
|
|
arg.ProfissionalID,
|
|
arg.Status,
|
|
arg.MotivoRejeicao,
|
|
)
|
|
var i AgendaProfissionai
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.AgendaID,
|
|
&i.ProfissionalID,
|
|
&i.Status,
|
|
&i.MotivoRejeicao,
|
|
&i.FuncaoID,
|
|
&i.CriadoEm,
|
|
&i.Posicao,
|
|
)
|
|
return i, err
|
|
}
|