carpool-service/handler/handler.go

30 lines
1.0 KiB
Go
Raw Normal View History

// 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 {
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) {
operator := cfg.GetString("interoperability.internal_operator_id")
2023-03-27 18:54:56 +00:00
return &CarpoolServiceHandler{
Config: cfg,
Storage: storage,
Tiles: tilesHandler,
Routing: routing,
InternalOperatorID: operator,
2023-03-27 18:54:56 +00:00
}, nil
}