2023-05-07 23:29:59 +00:00
|
|
|
// Package handler provides the business logic for the carpool service
|
2023-03-27 18:54:56 +00:00
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.coopgo.io/coopgo-platform/carpool-service/storage"
|
2023-03-29 10:50:25 +00:00
|
|
|
"git.coopgo.io/coopgo-platform/carpool-service/tiles"
|
|
|
|
"git.coopgo.io/coopgo-platform/routing-service"
|
2023-03-27 18:54:56 +00:00
|
|
|
"github.com/spf13/viper"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CarpoolServiceHandler struct {
|
2023-05-07 23:29:59 +00:00
|
|
|
Config *viper.Viper
|
|
|
|
Storage storage.Storage
|
|
|
|
Tiles *tiles.TilesHandler
|
|
|
|
Routing routing.RoutingService
|
|
|
|
InternalOperatorID string
|
2023-03-27 18:54:56 +00:00
|
|
|
}
|
|
|
|
|
2023-09-26 14:42:46 +00:00
|
|
|
// NewCarpoolServiceHandler initiates the carpool service handler, implementing the COOPGO Carpool Service business logic
|
2023-03-29 10:50:25 +00:00
|
|
|
func NewCarpoolServiceHandler(cfg *viper.Viper, storage storage.Storage, tilesHandler *tiles.TilesHandler, routing routing.RoutingService) (*CarpoolServiceHandler, error) {
|
2023-05-07 23:29:59 +00:00
|
|
|
operator := cfg.GetString("interoperability.internal_operator_id")
|
2023-03-27 18:54:56 +00:00
|
|
|
return &CarpoolServiceHandler{
|
2023-05-07 23:29:59 +00:00
|
|
|
Config: cfg,
|
|
|
|
Storage: storage,
|
|
|
|
Tiles: tilesHandler,
|
|
|
|
Routing: routing,
|
|
|
|
InternalOperatorID: operator,
|
2023-03-27 18:54:56 +00:00
|
|
|
}, nil
|
|
|
|
}
|