File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
adapters/out-persistence/src/main/kotlin/com/pokit/out/persistence/category/impl Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -50,12 +50,18 @@ class CategoryAdapter(
5050 }
5151
5252 override fun loadAllInId (categoryIds : List <Long >, pageable : Pageable ): Slice <Category > {
53- return if (pageable.sort.equals(" createdAt" )) {
54- categoryRepository.findAllByIdInAndCreatedAtSort(categoryIds, pageable, false )
55- .map { it.toDomain() }
56- } else {
57- categoryRepository.findAllByIdInAndNameSort(categoryIds, pageable, false )
58- .map { it.toDomain() }
53+ val order = pageable.sort.firstOrNull()
54+ val property = order?.property
55+
56+ return when (property) {
57+ " createdAt" -> {
58+ categoryRepository.findAllByIdInAndCreatedAtSort(categoryIds, pageable, false )
59+ .map { it.toDomain() }
60+ }
61+ else -> {
62+ categoryRepository.findAllByIdInAndNameSort(categoryIds, pageable, false )
63+ .map { it.toDomain() }
64+ }
5965 }
6066 }
6167
You can’t perform that action at this time.
0 commit comments