From 023f5c735d568379b818b81dce4d30d5ecb75d3e Mon Sep 17 00:00:00 2001 From: Nicolas CARON Date: Mon, 10 Feb 2025 12:47:41 +0100 Subject: [PATCH] add Diagdate --- go.mod | 2 +- go.sum | 2 ++ handlers/application/diags.go | 14 +++++++++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c8aa416..d1074fa 100755 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( require ( ariga.io/atlas v0.12.0 // indirect - git.coopgo.io/coopgo-platform/diags v0.0.0-20241120133550-917ed8705c73 + git.coopgo.io/coopgo-platform/diags v0.0.0-20250210110754-726bb4643c63 github.com/agext/levenshtein v1.2.1 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect diff --git a/go.sum b/go.sum index 504ad42..019071a 100644 --- a/go.sum +++ b/go.sum @@ -4,6 +4,8 @@ git.coopgo.io/coopgo-platform/agenda v1.0.0 h1:rTHgva1JKKO0wAPlINegifMkHm+xOg3IW git.coopgo.io/coopgo-platform/agenda v1.0.0/go.mod h1:/hToSla0p6SeWn1zo1MDrfxdmo7RBdZDkbLqCVituIM= git.coopgo.io/coopgo-platform/diags v0.0.0-20241120133550-917ed8705c73 h1:Xyc2Xuf7VnaOVD7sro2GPD1gzwo+R9lyfkWjyrTYlqY= git.coopgo.io/coopgo-platform/diags v0.0.0-20241120133550-917ed8705c73/go.mod h1:diyq11WNkgJ0kYHdT7SphXPMQUyoq4lRk7T6IgM5yPA= +git.coopgo.io/coopgo-platform/diags v0.0.0-20250210110754-726bb4643c63 h1:BvNTshj4TToGptaheeAzEmaNeuqPCR/NIH6TGePd54A= +git.coopgo.io/coopgo-platform/diags v0.0.0-20250210110754-726bb4643c63/go.mod h1:diyq11WNkgJ0kYHdT7SphXPMQUyoq4lRk7T6IgM5yPA= git.coopgo.io/coopgo-platform/emailing v0.0.0-20241119141913-9836b30191c1 h1:gAhJ9wwlitMiETmnD4U2L6xLnVd5xE4hPX72IJ5s7+I= git.coopgo.io/coopgo-platform/emailing v0.0.0-20241119141913-9836b30191c1/go.mod h1:EXy6NRvFfpW6yIHoZUixldkXrj1qzjCbTHpumDvzaKI= git.coopgo.io/coopgo-platform/fleets v0.0.0-20230310144446-feb935f8bf4e h1:eHahRTKlC8aBWYCd6LbXNcX8HoQhuZj31OFWrw0EL0U= diff --git a/handlers/application/diags.go b/handlers/application/diags.go index e737f27..f03138a 100644 --- a/handlers/application/diags.go +++ b/handlers/application/diags.go @@ -10,7 +10,7 @@ import ( "net/http" // "strconv" "strings" - // "time" + "time" "git.coopgo.io/coopgo-apps/parcoursmob/services" "git.coopgo.io/coopgo-apps/parcoursmob/utils/identification" @@ -25,7 +25,7 @@ import ( "github.com/gorilla/mux" "github.com/rs/zerolog/log" "google.golang.org/protobuf/types/known/structpb" - // "google.golang.org/protobuf/types/known/timestamppb" + "google.golang.org/protobuf/types/known/timestamppb" ) type DiagsForm struct { @@ -35,12 +35,12 @@ type DiagsForm struct { UiSchema string `json:"ui_schema"` Data map[string]any `json:"data"` Deleted bool `json:"deleted"` + Diagdate *time.Time `json:"diagdate"` } func (h *ApplicationHandler) DiagsHome(w http.ResponseWriter, r *http.Request) { resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{ Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"}, - // Mindate: timestamppb.New(time.Now().Add(-24 * time.Hour)), }) if err != nil { @@ -61,7 +61,6 @@ func (h *ApplicationHandler) DiagsHome(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) DiagsHistory(w http.ResponseWriter, r *http.Request) { resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{ Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"}, - //Maxdate: timestamppb.New(time.Now().Add(24 * time.Hour)), }) if err != nil { @@ -125,6 +124,7 @@ func (h *ApplicationHandler) BeneficiariesCreateDiag(w http.ResponseWriter, r *h UiSchema: diagForm.UiSchema, Data: data, Deleted: diagForm.Deleted, + Diagdate: timestamppb.New(time.Now()), }, } @@ -186,6 +186,7 @@ func (h *ApplicationHandler) VehiclesCreateDiag(w http.ResponseWriter, r *http.R UiSchema: diagForm.UiSchema, Data: data, Deleted: diagForm.Deleted, + Diagdate: timestamppb.New(time.Now()), }, } @@ -247,6 +248,7 @@ func (h *ApplicationHandler) BookingsCreateDiag(w http.ResponseWriter, r *http.R UiSchema: diagForm.UiSchema, Data: data, Deleted: diagForm.Deleted, + Diagdate: timestamppb.New(time.Now()), }, } @@ -308,6 +310,7 @@ func (h *ApplicationHandler) VehicleBookingsCreateDiag(w http.ResponseWriter, r UiSchema: diagForm.UiSchema, Data: data, Deleted: diagForm.Deleted, + Diagdate: timestamppb.New(time.Now()), }, } @@ -417,7 +420,7 @@ func (h *ApplicationHandler) DiagUpdate(w http.ResponseWriter, r *http.Request) JsonSchema: diagForm.JsonSchema, UiSchema: diagForm.UiSchema, Data: data, - + Diagdate: timestamppb.New(time.Now()), }, } @@ -461,6 +464,7 @@ func (h *ApplicationHandler) DiagDelete(w http.ResponseWriter, r *http.Request) UiSchema: resp.Diag.UiSchema, Data: resp.Diag.Data, Deleted: true, + Diagdate: resp.Diag.Diagdate, }, }