recurrents
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
package space.luminic.finance.services
|
||||
|
||||
import org.springframework.cache.annotation.CacheEvict
|
||||
import org.springframework.cache.annotation.Cacheable
|
||||
import org.springframework.jdbc.core.JdbcTemplate
|
||||
import org.springframework.stereotype.Service
|
||||
import org.springframework.transaction.annotation.Transactional
|
||||
import space.luminic.finance.dtos.SpaceDTO
|
||||
@@ -17,7 +14,7 @@ class SpaceServiceImpl(
|
||||
private val categoryService: CategoryService
|
||||
) : SpaceService {
|
||||
override fun checkSpace(spaceId: Int): Space {
|
||||
return getSpace(spaceId)
|
||||
return getSpace(spaceId, null)
|
||||
}
|
||||
|
||||
// @Cacheable(cacheNames = ["spaces"])
|
||||
@@ -27,8 +24,9 @@ class SpaceServiceImpl(
|
||||
return spaces
|
||||
}
|
||||
|
||||
override fun getSpace(id: Int): Space {
|
||||
val user = authService.getSecurityUserId()
|
||||
|
||||
override fun getSpace(id: Int, userId: Int?): Space {
|
||||
val user = userId ?: authService.getSecurityUserId()
|
||||
val space = spaceRepo.findSpaceById(id, user) ?: throw NotFoundException("Space with id $id not found")
|
||||
return space
|
||||
|
||||
@@ -56,7 +54,7 @@ class SpaceServiceImpl(
|
||||
space: SpaceDTO.UpdateSpaceDTO
|
||||
): Int {
|
||||
val userId = authService.getSecurityUserId()
|
||||
val existingSpace = getSpace(spaceId)
|
||||
val existingSpace = getSpace(spaceId, null)
|
||||
val updatedSpace = Space(
|
||||
id = existingSpace.id,
|
||||
name = space.name,
|
||||
|
||||
Reference in New Issue
Block a user