Get back to compiling, but using new jet for publicreport

This was an epically long change, and a terrible idea, but it compiles.
This was essentially a cascade that came about because I can't blend jet
and bob in the same transaction. In for a penny, I guess...
This commit is contained in:
Eli Ribble 2026-05-07 10:39:17 +00:00
parent a95e44cf42
commit fcd95f1a25
No known key found for this signature in database
65 changed files with 3129 additions and 3457 deletions

View file

@ -5,14 +5,14 @@ import (
"net/http"
"time"
"github.com/Gleipnir-Technology/nidus-sync/db/enums"
"github.com/Gleipnir-Technology/nidus-sync/db/models"
modelpublicreport "github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/publicreport/model"
//tablepublicreport "github.com/Gleipnir-Technology/nidus-sync/db/gen/nidus-sync/publicreport/table"
//querypublicreport "github.com/Gleipnir-Technology/nidus-sync/db/query/publicreport"
"github.com/Gleipnir-Technology/nidus-sync/html"
nhttp "github.com/Gleipnir-Technology/nidus-sync/http"
"github.com/Gleipnir-Technology/nidus-sync/platform"
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
"github.com/aarondl/opt/omit"
"github.com/aarondl/opt/omitnull"
"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/rs/zerolog/log"
@ -43,7 +43,7 @@ type waterForm struct {
AddressGID string `schema:"address-gid"`
ClientID uuid.UUID `schema:"client_id" json:"client_id"`
Comments string `schema:"comments"`
Duration omit.Val[enums.PublicreportNuisancedurationtype] `schema:"duration"`
Duration omit.Val[modelpublicreport.Nuisancedurationtype] `schema:"duration"`
HasAdult bool `schema:"has-adult"`
HasBackyardPermission bool `schema:"backyard-permission"`
HasLarvae bool `schema:"has-larvae"`
@ -80,44 +80,45 @@ func (res *waterR) Create(ctx context.Context, r *http.Request, w waterForm) (*w
if w.Location.Accuracy != nil {
accuracy = *w.Location.Accuracy
}
setter_report := models.PublicreportReportSetter{
AddressGid: omit.From(w.Address.GID),
AddressRaw: omit.From(w.Address.Raw),
ClientUUID: omitnull.From(w.ClientID),
Created: omit.From(time.Now()),
//H3cell: omitnull.From(geospatial.Cell.String()),
LatlngAccuracyType: omit.From(enums.PublicreportAccuracytypeBrowser),
LatlngAccuracyValue: omit.From(accuracy),
//Location: add later
Location: omitnull.FromPtr[string](nil),
MapZoom: omit.From(float32(0.0)),
//OrganizationID: omitnull.FromPtr(organization_id),
//PublicID: omit.From(public_id),
ReporterEmail: omit.From(""),
ReporterName: omit.From(""),
ReporterPhone: omit.From(""),
ReporterPhoneCanSMS: omit.From(true),
ReportType: omit.From(enums.PublicreportReporttypeWater),
Status: omit.From(enums.PublicreportReportstatustypeReported),
setter_report := modelpublicreport.Report{
//AddressID: omitnull.From(...),
AddressGid: w.Address.GID,
AddressRaw: w.Address.Raw,
ClientUUID: &w.ClientID,
Created: time.Now(),
//H3cell: omitnull.From(latlng.Cell.String()),
LatlngAccuracyType: modelpublicreport.Accuracytype_Browser,
LatlngAccuracyValue: accuracy,
//Location: omitnull.From(fmt.Sprintf("ST_GeometryFromText(Point(%s %s))", longitude, latitude)),
Location: nil,
MapZoom: float32(0.0),
//OrganizationID: ,
//PublicID:
ReporterEmail: "",
ReporterName: "",
ReporterPhone: "",
ReporterPhoneCanSms: true,
ReportType: modelpublicreport.Reporttype_Water,
Status: modelpublicreport.Reportstatustype_Reported,
}
setter_water := models.PublicreportWaterSetter{
AccessComments: omit.From(w.AccessComments),
AccessDog: omit.From(w.AccessDog),
AccessFence: omit.From(w.AccessFence),
AccessGate: omit.From(w.AccessGate),
AccessLocked: omit.From(w.AccessLocked),
AccessOther: omit.From(w.AccessOther),
Comments: omit.From(w.Comments),
Duration: w.Duration,
HasAdult: omit.From(w.HasAdult),
HasBackyardPermission: omit.From(w.HasBackyardPermission),
HasLarvae: omit.From(w.HasLarvae),
HasPupae: omit.From(w.HasPupae),
IsReporterConfidential: omit.From(w.IsReporterConfidential),
IsReporterOwner: omit.From(w.IsReporter_owner),
OwnerEmail: omit.From(w.OwnerEmail),
OwnerName: omit.From(w.OwnerName),
OwnerPhone: omit.From(w.OwnerPhone),
setter_water := modelpublicreport.Water{
AccessComments: w.AccessComments,
AccessDog: w.AccessDog,
AccessFence: w.AccessFence,
AccessGate: w.AccessGate,
AccessLocked: w.AccessLocked,
AccessOther: w.AccessOther,
Comments: w.Comments,
Duration: w.Duration.GetOr(modelpublicreport.Nuisancedurationtype_None),
HasAdult: w.HasAdult,
HasBackyardPermission: w.HasBackyardPermission,
HasLarvae: w.HasLarvae,
HasPupae: w.HasPupae,
IsReporterConfidential: w.IsReporterConfidential,
IsReporterOwner: w.IsReporter_owner,
OwnerEmail: w.OwnerEmail,
OwnerName: w.OwnerName,
OwnerPhone: w.OwnerPhone,
//ReportID omit.Val[int32]
}
report, err := platform.PublicReportWaterCreate(ctx, setter_report, setter_water, w.Location, w.Address, uploads)