Get all bookings
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 44s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 44s
This commit is contained in:
@@ -54,6 +54,39 @@ func (s *CarpoolServiceServerImpl) GetUserBookings(ctx context.Context, req *pro
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *CarpoolServiceServerImpl) GetCarpoolBookings(ctx context.Context, req *proto.GetCarpoolBookingsRequest) (*proto.GetCarpoolBookingsResponse, error) {
|
||||
log.Debug().
|
||||
Time("mindate", req.MinDate.AsTime()).
|
||||
Time("maxdate", req.MaxDate.AsTime()).
|
||||
Msg("grpc server - GetUserBookings")
|
||||
|
||||
var mindate *time.Time
|
||||
if req.MinDate != nil {
|
||||
d := req.MinDate.AsTime()
|
||||
mindate = &d
|
||||
}
|
||||
var maxdate *time.Time
|
||||
if req.MaxDate != nil {
|
||||
d := req.MaxDate.AsTime()
|
||||
maxdate = &d
|
||||
}
|
||||
|
||||
bookings, err := s.Handler.GetBookings(mindate, maxdate)
|
||||
if err != nil {
|
||||
return nil, status.Errorf(codes.Internal, "error retrieving user bookings - %s", err.Error())
|
||||
}
|
||||
|
||||
results := []*proto.CarpoolServiceBooking{}
|
||||
|
||||
for _, b := range bookings {
|
||||
nb := proto.BookingFromInternal(b)
|
||||
results = append(results, nb)
|
||||
}
|
||||
return &proto.GetCarpoolBookingsResponse{
|
||||
Bookings: results,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *CarpoolServiceServerImpl) UpdateBooking(ctx context.Context, req *proto.UpdateCarpoolBookingRequest) (*proto.UpdateCarpoolBookingResponse, error) {
|
||||
err := s.Handler.UpdateBookingStatus(req.BookingId, req.Status.ToOCSS())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user