carpool-service/handler/handler.go

30 lines
1.0 KiB
Go

// Package handler provides the business logic for the carpool service
package handler
import (
"git.coopgo.io/coopgo-platform/carpool-service/storage"
"git.coopgo.io/coopgo-platform/carpool-service/tiles"
"git.coopgo.io/coopgo-platform/routing-service"
"github.com/spf13/viper"
)
type CarpoolServiceHandler struct {
Config *viper.Viper
Storage storage.Storage
Tiles *tiles.TilesHandler
Routing routing.RoutingService
InternalOperatorID string
}
// NewCarpoolServiceHandler initiates the carpool service handler, implementing the COOPGO Carpool Service business logic
func NewCarpoolServiceHandler(cfg *viper.Viper, storage storage.Storage, tilesHandler *tiles.TilesHandler, routing routing.RoutingService) (*CarpoolServiceHandler, error) {
operator := cfg.GetString("interoperability.internal_operator_id")
return &CarpoolServiceHandler{
Config: cfg,
Storage: storage,
Tiles: tilesHandler,
Routing: routing,
InternalOperatorID: operator,
}, nil
}