source: bus-n-go-pavel-216049/bus-n-go-backend/src/main/kotlin/mk/ukim/finki/busngobackend/service/DirectionService.kt

Last change on this file was baf4cc4, checked in by ppaunovski <paunovskipavel@…>, 3 months ago

split group project and individual project into two separate folders

  • Property mode set to 100644
File size: 928 bytes
Line 
1package mk.ukim.finki.busngobackend.service
2
3import mk.ukim.finki.busngobackend.domain.entities.LinijaPravec
4import mk.ukim.finki.busngobackend.repository.LinijaPravecRepository
5import mk.ukim.finki.busngobackend.repository.LinijaRepository
6import mk.ukim.finki.busngobackend.repository.PravecRepository
7import mk.ukim.finki.busngobackend.service.exceptions.NotFoundException
8import org.springframework.data.repository.findByIdOrNull
9import org.springframework.stereotype.Service
10
11@Service
12class DirectionService(
13 private val pravecRepository: PravecRepository,
14 private val linijaPravecRepository: LinijaPravecRepository,
15 private val linijaRepository: LinijaRepository,
16) {
17 fun findDirectionsByLineId(lineId: Int): List<LinijaPravec> {
18 val linija = linijaRepository.findByIdOrNull(lineId) ?: throw NotFoundException("Line not found")
19 return linijaPravecRepository.findAllByLinija(linija)
20 }
21}
Note: See TracBrowser for help on using the repository browser.