parcoursmob/handlers/application/solidarity_service.go

45 lines
814 B
Go
Raw Normal View History

package application
import (
2024-08-02 13:02:35 +00:00
"context"
"fmt"
"net/http"
2024-08-02 13:02:35 +00:00
"time"
2024-08-07 09:47:35 +00:00
silvermobi "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto"
2024-08-02 13:02:35 +00:00
"google.golang.org/protobuf/types/known/timestamppb"
)
2024-08-02 13:02:35 +00:00
func (h *ApplicationHandler) DriversJourney(w http.ResponseWriter, r *http.Request) {
2024-08-02 13:02:35 +00:00
if r.Method == "POST" {
2024-08-02 13:02:35 +00:00
departureTime := time.Now()
timestamp := timestamppb.New(departureTime)
2024-08-07 09:47:35 +00:00
request := &silvermobi.DriverJourneysRequest{
2024-08-02 13:02:35 +00:00
DepartureDate: timestamp,
2024-08-07 09:47:35 +00:00
Departure: &silvermobi.Feature{
2024-08-02 13:02:35 +00:00
Lat: 0,
Long: 0,
Address: "7 rue D",
},
}
2024-08-07 09:47:35 +00:00
_, err := h.services.GRPC.Silvermobi.DriverJourneys(context.TODO(), request)
2024-08-02 13:02:35 +00:00
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
}
h.Renderer.SolidarityServiceBookingList(w, r)
}
2024-08-02 13:02:35 +00:00