parcoursmob/handlers/application/solidarity_service.go

45 lines
814 B
Go

package application
import (
"context"
"fmt"
"net/http"
"time"
silvermobi "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 := &silvermobi.DriverJourneysRequest{
DepartureDate: timestamp,
Departure: &silvermobi.Feature{
Lat: 0,
Long: 0,
Address: "7 rue D",
},
}
_, err := h.services.GRPC.Silvermobi.DriverJourneys(context.TODO(), request)
if err != nil {
fmt.Println(err)
w.WriteHeader(http.StatusInternalServerError)
return
}
}
h.Renderer.SolidarityServiceBookingList(w, r)
}