fix
This commit is contained in:
@@ -3,6 +3,7 @@ package grpcserver
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"solidarity-service/internal"
|
||||
"solidarity-service/servers/grpc/proto"
|
||||
"solidarity-service/utils"
|
||||
@@ -190,30 +191,38 @@ func (s *SolidarityServiceServerImpl) GetAllPassengers( ctx context.Context, _ *
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func (s *SolidarityServiceServerImpl) CreateBookingSolidarity(ctx context.Context, req *proto.CreateBookingSolidarityRequest) (resp *proto.CreateBookingSolidarityResponse, err error) {
|
||||
if req.Booking.DriverId == "" {
|
||||
func (s *SolidarityServiceServerImpl) GetPassenger(ctx context.Context, req *proto.GetPassengerRequest) (resp *proto.GetPassengerResponse, er error){
|
||||
if req.Passenger.Id == "" {
|
||||
return nil, errors.New("missing required DriverId")
|
||||
}
|
||||
if req.Booking.DepartureAddress == nil {
|
||||
return nil, errors.New("missing required DepartureAddress")
|
||||
p, err := s.Handler.GetPassenger(context.Background(), req.Passenger.Id)
|
||||
|
||||
resp = &proto.GetPassengerResponse{
|
||||
Passenger: &proto.User{
|
||||
Id: p.Passenger.ID,
|
||||
Alias: p.Passenger.Alias,
|
||||
FirstName: p.Passenger.FirstName,
|
||||
LastName: p.Passenger.LastName,
|
||||
Grade: p.Passenger.Grade,
|
||||
Picture: p.Passenger.Picture,
|
||||
Gender: p.Passenger.Gender,
|
||||
VerifiedIdentity: p.Passenger.VerifiedIdentity,
|
||||
},
|
||||
}
|
||||
if req.Booking.DestinationAddress == nil {
|
||||
return nil, errors.New("missing required DestinationAddress")
|
||||
|
||||
if err != nil {
|
||||
fmt.Println("err getpassenger : ", err)
|
||||
}else{
|
||||
return resp, nil
|
||||
}
|
||||
if req.Booking.PassengerId == "" {
|
||||
return nil, errors.New("missing required PassengerId")
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (s *SolidarityServiceServerImpl) CreateBookingSolidarity(ctx context.Context, req *proto.CreateBookingSolidarityRequest) (resp *proto.CreateBookingSolidarityResponse, err error) {
|
||||
if req.Booking.DriverId == "" || req.Booking.DepartureAddress == nil || req.Booking.DestinationAddress == nil || req.Booking.PassengerId == "" || req.Booking.Id == "" || req.Booking.Status.String() == "" ||req.Booking.PickupDate.Seconds == 0 {
|
||||
return nil, errors.New("missing required elements")
|
||||
}
|
||||
if req.Booking.Id == "" {
|
||||
return nil, errors.New("missing required Id")
|
||||
}
|
||||
if req.Booking.Status.String() == "" {
|
||||
return nil, errors.New("missing required Status")
|
||||
}
|
||||
|
||||
if req.Booking.PickupDate.Seconds == 0 {
|
||||
return nil, errors.New("missing required Seconds")
|
||||
}
|
||||
|
||||
|
||||
bookingRequest := internal.BookingRequest{
|
||||
ID: req.Booking.Id,
|
||||
|
||||
Reference in New Issue
Block a user