From b83fd3c884c7022ef9e4f1f2c94438f7d46a1ee6 Mon Sep 17 00:00:00 2001 From: huGgW Date: Tue, 19 Sep 2023 20:48:35 +0900 Subject: [PATCH] Hotfix: Fix main page orderby exception. --- .../csereal/core/main/database/MainRepository.kt | 6 ++++-- .../csereal/core/main/dto/MainNoticeResponse.kt | 6 ++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/main/database/MainRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/main/database/MainRepository.kt index 52e4fb08..57c487c5 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/main/database/MainRepository.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/main/database/MainRepository.kt @@ -55,8 +55,9 @@ class MainRepositoryImpl( MainNoticeResponse::class.java, noticeEntity.id, noticeEntity.title, - noticeEntity.createdAt - ) + noticeEntity.createdAt, + noticeEntity.isPinned, + ), ).from(noticeEntity) .where(noticeEntity.isDeleted.eq(false), noticeEntity.isPrivate.eq(false)) .orderBy(noticeEntity.isPinned.desc()).orderBy(noticeEntity.createdAt.desc()) @@ -70,6 +71,7 @@ class MainRepositoryImpl( noticeTagEntity.notice.id, noticeTagEntity.notice.title, noticeTagEntity.notice.createdAt, + noticeEntity.isPinned, ) ).from(noticeTagEntity) .rightJoin(noticeEntity).on(noticeTagEntity.notice.eq(noticeEntity)) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/main/dto/MainNoticeResponse.kt b/src/main/kotlin/com/wafflestudio/csereal/core/main/dto/MainNoticeResponse.kt index b90d7c60..fb395045 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/main/dto/MainNoticeResponse.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/main/dto/MainNoticeResponse.kt @@ -1,5 +1,6 @@ package com.wafflestudio.csereal.core.main.dto +import com.querydsl.core.annotations.QueryProjection import java.time.LocalDateTime data class MainNoticeResponse( @@ -7,4 +8,9 @@ data class MainNoticeResponse( val title: String, val createdAt: LocalDateTime? ) { + + @QueryProjection constructor ( + id: Long, title: String, createdAt: LocalDateTime?, isPinned: Boolean + ): this(id, title, createdAt) { + } } \ No newline at end of file