This commit is contained in:
2023-03-30 08:44:58 +02:00
parent bf6453b963
commit 0ae5730e7f
17 changed files with 305 additions and 44 deletions

View File

@@ -4,7 +4,7 @@ import (
"errors"
"time"
"git.coopgo.io/coopgo-platform/carpool-service/helpers"
"git.coopgo.io/coopgo-platform/carpool-service/internal"
"git.coopgo.io/coopgo-platform/carpool-service/tiles"
"git.coopgo.io/coopgo-platform/routing-service/encoding/polylines"
"github.com/google/uuid"
@@ -57,18 +57,18 @@ func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCol
return nil
}
func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (map[string][]helpers.PlannedRouteSchedule, error) {
func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (map[string][]internal.PlannedRouteSchedule, error) {
log.Debug().
Str("user_id", userid).
Time("min_departure_date", minDepartureDate).
Time("max_departure_date", maxDepartureDate).
Msg("carpool service handler - GetUserPlanning")
results := map[string][]helpers.PlannedRouteSchedule{}
results := map[string][]internal.PlannedRouteSchedule{}
current_date := minDepartureDate
for current_date.Before(maxDepartureDate) {
results[current_date.Format("2006-01-02")] = []helpers.PlannedRouteSchedule{}
results[current_date.Format("2006-01-02")] = []internal.PlannedRouteSchedule{}
current_date = current_date.Add(24 * time.Hour)
}
@@ -79,7 +79,7 @@ func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate
}
for _, r := range routes {
rr := helpers.RegularRoute(*r)
rr := internal.RegularRoute(*r)
schedules, err := rr.PlannedJourneySchedules(minDepartureDate, maxDepartureDate)
if err != nil {
log.Error().Err(err)