package grpcserver import ( "context" "fmt" "git.coopgo.io/coopgo-apps/silvermobi/servers/grpcapi/proto" "github.com/rs/zerolog/log" ) func (s *SolidarityService) SetDriverRegularAvailabilities(ctx context.Context, req *proto.DriverRegularAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) { log.Info(). Str("Driver ID", req.DriverRequest.Driver.Id). Msg("SetDriverRegularAvailabilities") resp, err = s.SolidarityClient.SetDriverRegularAvailabilities(ctx, req) return resp, err } func (s *SolidarityService) SetDriverPunctualAvailabilities(ctx context.Context, req *proto.DriverPunctualAvailabilities) (resp *proto.DriverAvailabilitiesResponse, err error) { log.Info(). Str("Driver ID", req.DriverRequest.Driver.Id). Msg("SetDriverRegularAvailabilities") resp, err = s.SolidarityClient.SetDriverPunctualAvailabilities(ctx, req) return resp, err } func (s *SolidarityService) CreateBooking(ctx context.Context, req *proto.CreateBookingRequest) (resp *proto.CreateBookingResponse, err error) { log.Info(). Str("Booking ID", req.Booking.Id). Msg("CreateBooking") resp, err = s.SolidarityClient.CreateBooking(ctx, req) if err == nil { _ = s.Handler.SendNotification(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.") err = s.Handler.SendEmail(req.Booking.DriverId, "Silvermobi", "Vous avez reçu une demande de trajet. \n Pour plus de détails, veuillez consulter l'interface \"Mes Trajets\" dans l'application SilverMobi.") fmt.Println(err) } return resp, err } func (s *SolidarityService) UpdateBooking(ctx context.Context, req *proto.UpdateBookingRequest) (resp *proto.UpdateBookingResponse, err error) { log.Info(). Str("Booking ID", req.BookingId). Msg("UpdateBooking") resp, err = s.SolidarityClient.UpdateBooking(ctx, req) return resp, err } func (s *SolidarityService) GetBooking(ctx context.Context, req *proto.GetBookingRequest) (resp *proto.GetBookingResponse, err error) { log.Info(). Str("Booking ID", req.BookingId). Msg("GetBooking") resp, err = s.SolidarityClient.GetBooking(ctx, req) return resp, err } func (s *SolidarityService) GetBookingsByStatus(ctx context.Context, req *proto.GetBookingsByStatusRequest) (resp *proto.GetBookingsByStatusResponse, err error) { log.Info(). Str("User ID", req.UserId). Msg("GetBookingByStatus") resp, err = s.SolidarityClient.GetBookingsByStatus(ctx, req) return resp, err } func (s *SolidarityService) DriverJourneys(ctx context.Context, req *proto.DriverJourneysRequest) (resp *proto.DriverJourneysResponse, err error) { log.Info(). Str("Address", req.Departure.Address). Msg("DriverJourneys") resp, err = s.SolidarityClient.DriverJourneys(ctx, req) return resp, err } func (s *SolidarityService) SetPassengerTrip(ctx context.Context, req *proto.PassengerTripRequest) (resp *proto.PassengerTripResponse, err error) { log.Info(). Str("Passenger ID", req.Passenger.Id). Msg("SetPassengerTrip") resp, err = s.SolidarityClient.SetPassengerTrip(ctx, req) return resp, err }