add Diagdate

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

View File

@@ -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,
},
}