Fix populating water report from ID, make ContactSimple

ContactSimple is the replacement for ContactReporter, which was the
simplified form of a contact from a report. I made the name more generic
and use it in the general report structures for consistency.
This commit is contained in:
Eli Ribble 2026-05-21 03:23:10 +00:00
parent 75d0283453
commit 5e103f46a0
No known key found for this signature in database
14 changed files with 103 additions and 108 deletions

View file

@ -4,10 +4,10 @@ import (
"context"
//"time"
"github.com/Gleipnir-Technology/jet/postgres"
"source.gleipnir.technology/Gleipnir/nidus-sync/db"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/publicreport/model"
"source.gleipnir.technology/Gleipnir/nidus-sync/db/gen/nidus-sync/publicreport/table"
//"github.com/Gleipnir-Technology/jet/postgres"
)
func WaterInsert(ctx context.Context, txn db.Ex, m model.Water) (model.Water, error) {
@ -16,3 +16,9 @@ func WaterInsert(ctx context.Context, txn db.Ex, m model.Water) (model.Water, er
RETURNING(table.Water.AllColumns)
return db.ExecuteOneTx[model.Water](ctx, txn, statement)
}
func WaterFromReportID(ctx context.Context, txn db.Ex, report_id int64) (model.Water, error) {
statement := table.Water.SELECT(table.Water.AllColumns).
FROM(table.Water).
WHERE(table.Water.ReportID.EQ(postgres.Int(report_id)))
return db.ExecuteOneTx[model.Water](ctx, txn, statement)
}