parcoursmob/handlers/application/solidarity_service.go

45 lines
845 B
Go

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