feat: atualizar fluxo OT, dashboard, transacoes e PDFs
This commit is contained in:
@@ -21,7 +21,7 @@ type Invoice struct {
|
||||
|
||||
func ListInvoices(ctx context.Context, conn *pgxpool.Conn) ([]*Invoice, error) {
|
||||
rows, err := conn.Query(ctx,
|
||||
`SELECT id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, created_at
|
||||
`SELECT id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, issued_at AS created_at
|
||||
FROM invoices ORDER BY issued_at DESC`)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("invoice: list: %w", err)
|
||||
@@ -41,7 +41,7 @@ func ListInvoices(ctx context.Context, conn *pgxpool.Conn) ([]*Invoice, error) {
|
||||
|
||||
func GetInvoice(ctx context.Context, conn *pgxpool.Conn, id string) (*Invoice, error) {
|
||||
row := conn.QueryRow(ctx,
|
||||
`SELECT id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, created_at
|
||||
`SELECT id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, issued_at AS created_at
|
||||
FROM invoices WHERE id = $1`, id)
|
||||
var inv Invoice
|
||||
err := row.Scan(&inv.ID, &inv.WorkOrderID, &inv.Type, &inv.Number,
|
||||
@@ -59,7 +59,7 @@ func CreateInvoice(ctx context.Context, conn *pgxpool.Conn, woID, docType string
|
||||
row := conn.QueryRow(ctx,
|
||||
`INSERT INTO invoices (work_order_id, type, issued_at)
|
||||
VALUES ($1, $2, NOW())
|
||||
RETURNING id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, created_at`,
|
||||
RETURNING id, work_order_id, type, number, COALESCE(pdf_path,''), issued_at, issued_at AS created_at`,
|
||||
woID, docType)
|
||||
var inv Invoice
|
||||
if err := row.Scan(&inv.ID, &inv.WorkOrderID, &inv.Type, &inv.Number,
|
||||
|
||||
Reference in New Issue
Block a user