diff --git a/src/main/kotlin/com/moa/entity/Term.kt b/src/main/kotlin/com/moa/entity/Term.kt index 5d56e9d..ec4287c 100644 --- a/src/main/kotlin/com/moa/entity/Term.kt +++ b/src/main/kotlin/com/moa/entity/Term.kt @@ -17,6 +17,9 @@ class Term( @Column(nullable = false) val contentUrl: String, + + @Column(nullable = false) + val sortOrder: Int, ) { companion object { const val MARKETING = "MARKETING" diff --git a/src/main/kotlin/com/moa/service/TermsService.kt b/src/main/kotlin/com/moa/service/TermsService.kt index b20e05c..a8989a6 100644 --- a/src/main/kotlin/com/moa/service/TermsService.kt +++ b/src/main/kotlin/com/moa/service/TermsService.kt @@ -16,10 +16,12 @@ class TermsService( private val termAgreementRepository: TermAgreementRepository, ) { + private val TERM_SORTER = compareBy { it.sortOrder } + @Transactional(readOnly = true) fun getTerms(): TermsResponse { val terms = termRepository.findAll() - .sortedWith(compareByDescending { it.required }.thenBy { it.code }) + .sortedWith(TERM_SORTER) .map { TermDto( code = it.code,