truck-company/internal/usecase/usecase.go

29 lines
574 B
Go

package usecase
import (
"truck-company/internal/domain"
"truck-company/internal/repository"
)
type UseCase struct {
AppRepo repository.AppRepo
}
func NewUseCase(r repository.AppRepo) *UseCase {
return &UseCase{
AppRepo: r,
}
}
func (u *UseCase) GetAllRoutes() ([]domain.Route, error) {
return u.AppRepo.GetAllRoutes()
}
func (u *UseCase) GetTransportByRoute(routeID int64) ([]domain.Transport, error) {
return u.AppRepo.GetTransportByRoute(routeID)
}
func (u *UseCase) GetCargoCost(cargoID int64) (float64, error) {
return u.AppRepo.GetCargoCost(cargoID)
}