recurrents
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package space.luminic.finance.services.telegram
|
||||
|
||||
import org.springframework.stereotype.Service
|
||||
import space.luminic.finance.models.NotFoundException
|
||||
import space.luminic.finance.models.Space
|
||||
import space.luminic.finance.repos.SpaceRepo
|
||||
|
||||
@Service("spaceServiceTelegram")
|
||||
class SpaceServiceImpl(
|
||||
private val spaceRepo: SpaceRepo
|
||||
) : SpaceService {
|
||||
override fun getSpaces(userId: Int): List<Space> {
|
||||
val spaces = spaceRepo.findSpacesAvailableForUser(userId)
|
||||
return spaces
|
||||
}
|
||||
|
||||
override fun getSpace(spaceId: Int, userId: Int): Space? {
|
||||
val space =
|
||||
spaceRepo.findSpaceById(spaceId, userId) ?: throw NotFoundException("Space with id $spaceId not found")
|
||||
return space
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user