Backend: - Implementa rota e serviço de importação em lote (`/api/import/fot`). - Adiciona suporte a "Upsert" para atualizar registros existentes sem duplicar. - Corrige e migra schema do banco: ajuste na precisão de valores monetários e correções de sintaxe. Frontend: - Cria página de Importação de Dados com visualização de log e tratamento de erros. - Implementa melhorias de UX nas tabelas (Importação e Gestão de FOT): - Contadores de total de registros. - Funcionalidade "Drag-to-Scroll" (arrastar para rolar). - Barra de rolagem superior sincronizada na tabela de gestão. - Corrige bug de "tela branca" ao filtrar dados vazios na gestão.
94 lines
2.7 KiB
Go
94 lines
2.7 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.30.0
|
|
// source: anos_formaturas.sql
|
|
|
|
package generated
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const createAnoFormatura = `-- name: CreateAnoFormatura :one
|
|
INSERT INTO anos_formaturas (ano_semestre) VALUES ($1) RETURNING id, ano_semestre, criado_em
|
|
`
|
|
|
|
func (q *Queries) CreateAnoFormatura(ctx context.Context, anoSemestre string) (AnosFormatura, error) {
|
|
row := q.db.QueryRow(ctx, createAnoFormatura, anoSemestre)
|
|
var i AnosFormatura
|
|
err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm)
|
|
return i, err
|
|
}
|
|
|
|
const deleteAnoFormatura = `-- name: DeleteAnoFormatura :exec
|
|
DELETE FROM anos_formaturas WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) DeleteAnoFormatura(ctx context.Context, id pgtype.UUID) error {
|
|
_, err := q.db.Exec(ctx, deleteAnoFormatura, id)
|
|
return err
|
|
}
|
|
|
|
const getAnoFormaturaByID = `-- name: GetAnoFormaturaByID :one
|
|
SELECT id, ano_semestre, criado_em FROM anos_formaturas WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetAnoFormaturaByID(ctx context.Context, id pgtype.UUID) (AnosFormatura, error) {
|
|
row := q.db.QueryRow(ctx, getAnoFormaturaByID, id)
|
|
var i AnosFormatura
|
|
err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm)
|
|
return i, err
|
|
}
|
|
|
|
const getAnoFormaturaByNome = `-- name: GetAnoFormaturaByNome :one
|
|
SELECT id, ano_semestre, criado_em FROM anos_formaturas WHERE ano_semestre = $1
|
|
`
|
|
|
|
func (q *Queries) GetAnoFormaturaByNome(ctx context.Context, anoSemestre string) (AnosFormatura, error) {
|
|
row := q.db.QueryRow(ctx, getAnoFormaturaByNome, anoSemestre)
|
|
var i AnosFormatura
|
|
err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm)
|
|
return i, err
|
|
}
|
|
|
|
const listAnosFormaturas = `-- name: ListAnosFormaturas :many
|
|
SELECT id, ano_semestre, criado_em FROM anos_formaturas ORDER BY ano_semestre
|
|
`
|
|
|
|
func (q *Queries) ListAnosFormaturas(ctx context.Context) ([]AnosFormatura, error) {
|
|
rows, err := q.db.Query(ctx, listAnosFormaturas)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []AnosFormatura
|
|
for rows.Next() {
|
|
var i AnosFormatura
|
|
if err := rows.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|
|
|
|
const updateAnoFormatura = `-- name: UpdateAnoFormatura :one
|
|
UPDATE anos_formaturas SET ano_semestre = $2 WHERE id = $1 RETURNING id, ano_semestre, criado_em
|
|
`
|
|
|
|
type UpdateAnoFormaturaParams struct {
|
|
ID pgtype.UUID `json:"id"`
|
|
AnoSemestre string `json:"ano_semestre"`
|
|
}
|
|
|
|
func (q *Queries) UpdateAnoFormatura(ctx context.Context, arg UpdateAnoFormaturaParams) (AnosFormatura, error) {
|
|
row := q.db.QueryRow(ctx, updateAnoFormatura, arg.ID, arg.AnoSemestre)
|
|
var i AnosFormatura
|
|
err := row.Scan(&i.ID, &i.AnoSemestre, &i.CriadoEm)
|
|
return i, err
|
|
}
|