From 4bbfbdb9e6b4541809eded1a7a4e4bab7bfdbcaa Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Fri, 27 Mar 2026 14:06:50 -0700 Subject: [PATCH] Pretty all the things I missed My laptop didn't have lefthook running. Oops. --- api/handler.go | 13 +- api/signin.go | 1 + api/signup.go | 7 +- platform/dashboard.go | 1 + platform/signal.go | 2 +- platform/user.go | 2 +- sync/cell.go | 22 +- sync/dash.go | 14 +- sync/upload.go | 3 +- ts/client.ts | 26 +- ts/components/CSVUpload.vue | 397 ++++++++++---------- ts/components/CommunicationColumnDetail.vue | 5 +- ts/components/FlyoverPoolCard.vue | 13 +- ts/components/MapMultipoint.vue | 9 +- ts/components/MapProxiedArcgisTile.vue | 10 +- ts/components/PlanningColumnAction.vue | 32 +- ts/components/PlanningColumnDetail.vue | 37 +- ts/components/PlanningColumnDetailEntry.vue | 6 +- ts/components/PlanningColumnList.vue | 5 +- ts/components/PlanningColumnListEntry.vue | 4 +- ts/components/PublicreportCard.vue | 55 +-- ts/router.ts | 43 ++- ts/view/Communication.vue | 2 +- ts/view/NotFound.vue | 2 +- ts/view/Signin.vue | 39 +- ts/view/configuration/Root.vue | 5 +- ts/view/configuration/Upload.vue | 40 +- ts/view/configuration/UploadPool.vue | 50 ++- ts/view/configuration/UploadPoolFlyover.vue | 5 +- vite.config.ts | 127 ++++--- 30 files changed, 490 insertions(+), 487 deletions(-) diff --git a/api/handler.go b/api/handler.go index 2bfa5f0b..2b6541d8 100644 --- a/api/handler.go +++ b/api/handler.go @@ -119,7 +119,7 @@ func handlerJSONPost[ReqType any](f handlerFunctionPost[ReqType]) http.HandlerFu ctx := r.Context() path, e := f(ctx, r, *req) if e != nil { - return + return } http.Redirect(w, r, path, http.StatusFound) } @@ -128,6 +128,7 @@ func handlerJSONPost[ReqType any](f handlerFunctionPost[ReqType]) http.HandlerFu type postMultipartResponse struct { URI string `json:"uri"` } + func authenticatedHandlerPostMultipart(f handlerFunctionPostAuthenticated[[]file.Upload], collection file.Collection) http.Handler { return auth.NewEnsureAuth(func(w http.ResponseWriter, r *http.Request, u platform.User) { err := r.ParseMultipartForm(32 << 10) // 32 MB buffer @@ -142,11 +143,11 @@ func authenticatedHandlerPostMultipart(f handlerFunctionPostAuthenticated[[]file } /* - err = decoder.Decode(&content, r.PostForm) - if err != nil { - respondError(w, http.StatusBadRequest, "Failed to decode form: %w", err) - return - } + err = decoder.Decode(&content, r.PostForm) + if err != nil { + respondError(w, http.StatusBadRequest, "Failed to decode form: %w", err) + return + } */ ctx := r.Context() path, e := f(ctx, r, u, uploads) diff --git a/api/signin.go b/api/signin.go index 6af9bb89..ccc615bd 100644 --- a/api/signin.go +++ b/api/signin.go @@ -14,6 +14,7 @@ type reqSignin struct { Password string `json:"password"` Username string `json:"username"` } + func postSignin(ctx context.Context, r *http.Request, req reqSignin) (string, *nhttp.ErrorWithStatus) { if req.Password == "" { return "", nhttp.NewErrorStatus(http.StatusBadRequest, "Empty password") diff --git a/api/signup.go b/api/signup.go index da518637..e8e7bad6 100644 --- a/api/signup.go +++ b/api/signup.go @@ -9,12 +9,14 @@ import ( nhttp "github.com/Gleipnir-Technology/nidus-sync/http" "github.com/rs/zerolog/log" ) + type reqSignup struct { Username string `json:"username"` - Name string `json:"name"` + Name string `json:"name"` Password string `json:"password"` - Terms bool `json:"terms"` + Terms bool `json:"terms"` } + func postSignup(ctx context.Context, r *http.Request, signup reqSignup) (string, *nhttp.ErrorWithStatus) { log.Info().Str("username", signup.Username).Str("name", signup.Name).Str("password", strings.Repeat("*", len(signup.Password))).Msg("Signup") @@ -33,4 +35,3 @@ func postSignup(ctx context.Context, r *http.Request, signup reqSignup) (string, return "/", nil } - diff --git a/platform/dashboard.go b/platform/dashboard.go index fed1e484..da7bdd17 100644 --- a/platform/dashboard.go +++ b/platform/dashboard.go @@ -6,6 +6,7 @@ import ( nhttp "github.com/Gleipnir-Technology/nidus-sync/http" ) + type ServiceRequestSummary struct { Date time.Time Location string diff --git a/platform/signal.go b/platform/signal.go index a8ab5764..b82a58e0 100644 --- a/platform/signal.go +++ b/platform/signal.go @@ -228,7 +228,7 @@ func SignalList(ctx context.Context, user User, limit int) ([]*Signal, error) { row.Pool = p row.Report = nil } else if row.Report.ID != 0 { - report, ok := report_map[row.Report.ID] + report, ok := report_map[row.Report.ID] if !ok { return nil, fmt.Errorf("failed to get report %d for %d", row.Report.ID, row.ID) } diff --git a/platform/user.go b/platform/user.go index 56d7f959..4032689f 100644 --- a/platform/user.go +++ b/platform/user.go @@ -73,7 +73,7 @@ func newUser(ctx context.Context, org Organization, user *models.User) User { func CreateUser(ctx context.Context, username string, name string, password_hash string) (*User, error) { o_setter := models.OrganizationSetter{ IsCatchall: omit.From(false), - Name: omit.From(fmt.Sprintf("%s's organization", username)), + Name: omit.From(fmt.Sprintf("%s's organization", username)), } o, err := models.Organizations.Insert(&o_setter).One(ctx, db.PGInstance.BobDB) if err != nil { diff --git a/sync/cell.go b/sync/cell.go index 247a7e9e..989601c4 100644 --- a/sync/cell.go +++ b/sync/cell.go @@ -38,15 +38,15 @@ func getCellDetails(ctx context.Context, r *http.Request, user platform.User) (* return nil, nhttp.NewError("Failed to get inspections by cell: %w", err) } /* - center, err := h3.Cell(c).LatLng() - if err != nil { - return nil, nhttp.NewError("Failed to get center: %w", err) - } - geojson, err := h3utils.H3ToGeoJSON([]h3.Cell{h3.Cell(c)}) - if err != nil { - return nil, nhttp.NewError("Failed to get boundaries: %w", err) - } - resolution := h3.Cell(c).Resolution() + center, err := h3.Cell(c).LatLng() + if err != nil { + return nil, nhttp.NewError("Failed to get center: %w", err) + } + geojson, err := h3utils.H3ToGeoJSON([]h3.Cell{h3.Cell(c)}) + if err != nil { + return nil, nhttp.NewError("Failed to get boundaries: %w", err) + } + resolution := h3.Cell(c).Resolution() */ sources, err := platform.BreedingSourcesByCell(ctx, user.Organization, h3.Cell(c)) if err != nil { @@ -65,7 +65,7 @@ func getCellDetails(ctx context.Context, r *http.Request, user platform.User) (* BreedingSources: sources, CellBoundary: boundary, Inspections: inspections, - Traps: traps, - Treatments: treatments, + Traps: traps, + Treatments: treatments, }), nil } diff --git a/sync/dash.go b/sync/dash.go index bfa060ae..a953f4e3 100644 --- a/sync/dash.go +++ b/sync/dash.go @@ -21,8 +21,8 @@ type contentSource struct { User platform.User } type contentTrap struct { - Trap platform.Trap - User platform.User + Trap platform.Trap + User platform.User } type contentLayoutTest struct { User platform.User @@ -71,7 +71,7 @@ func getSource(ctx context.Context, r *http.Request, user platform.User) (*html. } treatment_models := platform.ModelTreatment(treatments) data := contentSource{ - Inspections: inspections, + Inspections: inspections, Source: s, Traps: traps, Treatments: treatments, @@ -99,10 +99,10 @@ func getTrap(ctx context.Context, r *http.Request, user platform.User) (*html.Re return nil, nhttp.NewError("Failed to get trap: %w", err) } /* - latlng, err := t.H3Cell.LatLng() - if err != nil { - return nil, nhttp.NewError("Failed to get latlng: %w", err) - } + latlng, err := t.H3Cell.LatLng() + if err != nil { + return nil, nhttp.NewError("Failed to get latlng: %w", err) + } */ data := contentTrap{ Trap: *t, diff --git a/sync/upload.go b/sync/upload.go index 45f98b32..0bf471b0 100644 --- a/sync/upload.go +++ b/sync/upload.go @@ -1,4 +1,3 @@ package sync -import ( -) +import () diff --git a/ts/client.ts b/ts/client.ts index e03f1751..da356f68 100644 --- a/ts/client.ts +++ b/ts/client.ts @@ -1,24 +1,24 @@ // src/api/axios.js or similar -import axios from 'axios'; -import router from '@/router'; +import axios from "axios"; +import router from "@/router"; const apiClient = axios.create({ - baseURL: '/api', - withCredentials: true + baseURL: "/api", + withCredentials: true, }); // Response interceptor to catch auth failures apiClient.interceptors.response.use( - (response) => response, - (error) => { - if (error.response && error.response.status === 401) { - // Session expired or not authenticated - router.push('/login'); - } - return Promise.reject(error); - } + (response) => response, + (error) => { + if (error.response && error.response.status === 401) { + // Session expired or not authenticated + router.push("/login"); + } + return Promise.reject(error); + }, ); apiClient.isAuthenticated = () => { return true; -} +}; export default apiClient; diff --git a/ts/components/CSVUpload.vue b/ts/components/CSVUpload.vue index 6113138b..f35cb56c 100644 --- a/ts/components/CSVUpload.vue +++ b/ts/components/CSVUpload.vue @@ -1,209 +1,220 @@ - diff --git a/ts/components/CommunicationColumnDetail.vue b/ts/components/CommunicationColumnDetail.vue index 1dedcb3e..56baa13a 100644 --- a/ts/components/CommunicationColumnDetail.vue +++ b/ts/components/CommunicationColumnDetail.vue @@ -57,7 +57,10 @@
- +
diff --git a/ts/components/FlyoverPoolCard.vue b/ts/components/FlyoverPoolCard.vue index cfe35cc1..96e35455 100644 --- a/ts/components/FlyoverPoolCard.vue +++ b/ts/components/FlyoverPoolCard.vue @@ -1,12 +1,13 @@