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 | |
---|
1 | package mk.ukim.finki.busngobackend.service
|
---|
2 |
|
---|
3 | import mk.ukim.finki.busngobackend.domain.entities.LinijaPravec
|
---|
4 | import mk.ukim.finki.busngobackend.repository.LinijaPravecRepository
|
---|
5 | import mk.ukim.finki.busngobackend.repository.LinijaRepository
|
---|
6 | import mk.ukim.finki.busngobackend.repository.PravecRepository
|
---|
7 | import mk.ukim.finki.busngobackend.service.exceptions.NotFoundException
|
---|
8 | import org.springframework.data.repository.findByIdOrNull
|
---|
9 | import org.springframework.stereotype.Service
|
---|
10 |
|
---|
11 | @Service
|
---|
12 | class 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.