add Diagdate

This commit is contained in:
Nicolas CARON 2025-02-10 12:47:41 +01:00
parent a1adc028df
commit 023f5c735d
3 changed files with 12 additions and 6 deletions

2
go.mod
View File

@ -51,7 +51,7 @@ require (
require ( require (
ariga.io/atlas v0.12.0 // indirect 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/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect

2
go.sum
View File

@ -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/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 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-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 h1:gAhJ9wwlitMiETmnD4U2L6xLnVd5xE4hPX72IJ5s7+I=
git.coopgo.io/coopgo-platform/emailing v0.0.0-20241119141913-9836b30191c1/go.mod h1:EXy6NRvFfpW6yIHoZUixldkXrj1qzjCbTHpumDvzaKI= 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= git.coopgo.io/coopgo-platform/fleets v0.0.0-20230310144446-feb935f8bf4e h1:eHahRTKlC8aBWYCd6LbXNcX8HoQhuZj31OFWrw0EL0U=

View File

@ -10,7 +10,7 @@ import (
"net/http" "net/http"
// "strconv" // "strconv"
"strings" "strings"
// "time" "time"
"git.coopgo.io/coopgo-apps/parcoursmob/services" "git.coopgo.io/coopgo-apps/parcoursmob/services"
"git.coopgo.io/coopgo-apps/parcoursmob/utils/identification" "git.coopgo.io/coopgo-apps/parcoursmob/utils/identification"
@ -25,7 +25,7 @@ import (
"github.com/gorilla/mux" "github.com/gorilla/mux"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"google.golang.org/protobuf/types/known/structpb" "google.golang.org/protobuf/types/known/structpb"
// "google.golang.org/protobuf/types/known/timestamppb" "google.golang.org/protobuf/types/known/timestamppb"
) )
type DiagsForm struct { type DiagsForm struct {
@ -35,12 +35,12 @@ type DiagsForm struct {
UiSchema string `json:"ui_schema"` UiSchema string `json:"ui_schema"`
Data map[string]any `json:"data"` Data map[string]any `json:"data"`
Deleted bool `json:"deleted"` Deleted bool `json:"deleted"`
Diagdate *time.Time `json:"diagdate"`
} }
func (h *ApplicationHandler) DiagsHome(w http.ResponseWriter, r *http.Request) { func (h *ApplicationHandler) DiagsHome(w http.ResponseWriter, r *http.Request) {
resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{ resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{
Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"}, Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"},
// Mindate: timestamppb.New(time.Now().Add(-24 * time.Hour)),
}) })
if err != nil { 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) { func (h *ApplicationHandler) DiagsHistory(w http.ResponseWriter, r *http.Request) {
resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{ resp, err := h.services.GRPC.Diags.GetDiags(context.TODO(), &diags.GetDiagsRequest{
Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"}, Namespaces: []string{"parcoursmob_beneficiaries", "parcoursmob_diagnostiques", "parcoursmob_vehicles", "parcoursmob_bookings"},
//Maxdate: timestamppb.New(time.Now().Add(24 * time.Hour)),
}) })
if err != nil { if err != nil {
@ -125,6 +124,7 @@ func (h *ApplicationHandler) BeneficiariesCreateDiag(w http.ResponseWriter, r *h
UiSchema: diagForm.UiSchema, UiSchema: diagForm.UiSchema,
Data: data, Data: data,
Deleted: diagForm.Deleted, 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, UiSchema: diagForm.UiSchema,
Data: data, Data: data,
Deleted: diagForm.Deleted, 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, UiSchema: diagForm.UiSchema,
Data: data, Data: data,
Deleted: diagForm.Deleted, Deleted: diagForm.Deleted,
Diagdate: timestamppb.New(time.Now()),
}, },
} }
@ -308,6 +310,7 @@ func (h *ApplicationHandler) VehicleBookingsCreateDiag(w http.ResponseWriter, r
UiSchema: diagForm.UiSchema, UiSchema: diagForm.UiSchema,
Data: data, Data: data,
Deleted: diagForm.Deleted, 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, JsonSchema: diagForm.JsonSchema,
UiSchema: diagForm.UiSchema, UiSchema: diagForm.UiSchema,
Data: data, 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, UiSchema: resp.Diag.UiSchema,
Data: resp.Diag.Data, Data: resp.Diag.Data,
Deleted: true, Deleted: true,
Diagdate: resp.Diag.Diagdate,
}, },
} }