Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	backend/application/api/src/main/kotlin/io/raemian/api/goal/service/GoalQueryService.kt
  • Loading branch information
egg528 committed Apr 26, 2024
2 parents f201076 + 9ba3988 commit 75c4469
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import io.raemian.api.lifemap.service.LifeMapService
import io.raemian.api.support.response.OffsetPaginationResult
import io.raemian.api.task.service.TaskService
import io.raemian.storage.db.core.goal.GoalJdbcQueryRepository
import io.raemian.storage.db.core.goal.GoalRepository
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

Expand All @@ -19,15 +18,14 @@ class GoalQueryService(
private val lifeMapService: LifeMapService,
private val goalJdbcQueryRepository: GoalJdbcQueryRepository,
private val lifeMapCountQueryService: LifeMapCountQueryService,
private val goalRepository: GoalRepository,
private val emojiService: EmojiService,
private val taskService: TaskService,
private val commentService: CommentService,
) {
@Transactional(readOnly = true)
fun findAllByUsernameWithOffset(username: String, request: TimelinePageRequest): OffsetPaginationResult<GoalTimelinePageResult> {
val lifeMap = lifeMapService.getFirstByUserName(username)
val goals = goalJdbcQueryRepository.findAllByLifeMapWithOffset(lifeMap.lifeMapId, request.page, request.size)
val goals = goalJdbcQueryRepository.findAllByLifeMapWithOffset(lifeMap.lifeMapId, request.page * request.size, request.size)

if (goals.isEmpty()) {
return OffsetPaginationResult.empty(request.page, request.size)
Expand Down Expand Up @@ -57,7 +55,7 @@ class GoalQueryService(
@Transactional(readOnly = true)
fun findAllByUserIdWithOffset(userId: Long, request: TimelinePageRequest): OffsetPaginationResult<GoalTimelinePageResult> {
val lifeMap = lifeMapService.getFirstByUserId(userId)
val goals = goalJdbcQueryRepository.findAllByLifeMapWithOffset(lifeMap.lifeMapId, request.page, request.size)
val goals = goalJdbcQueryRepository.findAllByLifeMapWithOffset(lifeMap.lifeMapId, request.page * request.size, request.size)
if (goals.isEmpty()) {
return OffsetPaginationResult.empty(request.page, request.size)
}
Expand Down

0 comments on commit 75c4469

Please sign in to comment.