diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/NoticeRepository.kt b/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/NoticeRepository.kt index f2615c8f..0277a82f 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/NoticeRepository.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/notice/database/NoticeRepository.kt @@ -2,6 +2,7 @@ package com.wafflestudio.csereal.core.notice.database import com.querydsl.core.BooleanBuilder import com.querydsl.core.types.Projections +import com.querydsl.core.types.dsl.Expressions import com.querydsl.jpa.impl.JPAQueryFactory import com.wafflestudio.csereal.common.enums.ContentSearchSortType import com.wafflestudio.csereal.common.repository.CommonRepository @@ -142,7 +143,8 @@ class NoticeRepositoryImpl( noticeEntity.isPinned, noticeEntity.attachments.isNotEmpty, noticeEntity.isPrivate, - scoreOrNull + // if scoreOrNull is null, put 0.0 + scoreOrNull ?: Expressions.numberTemplate(Double::class.javaObjectType, "0.0") ) ).from(noticeEntity) .leftJoin(noticeTagEntity).on(noticeTagEntity.notice.eq(noticeEntity)) diff --git a/src/main/kotlin/com/wafflestudio/csereal/core/notice/dto/NoticeSearchDto.kt b/src/main/kotlin/com/wafflestudio/csereal/core/notice/dto/NoticeSearchDto.kt index 3e8d0409..8dffde59 100644 --- a/src/main/kotlin/com/wafflestudio/csereal/core/notice/dto/NoticeSearchDto.kt +++ b/src/main/kotlin/com/wafflestudio/csereal/core/notice/dto/NoticeSearchDto.kt @@ -19,7 +19,7 @@ data class NoticeSearchDto( isPinned: Boolean, hasAttachment: Boolean, isPrivate: Boolean, - score: Double? + score: Double ) : this(id, title, createdAt, isPinned, hasAttachment, isPrivate) constructor(entity: NoticeEntity, hasAttachment: Boolean) : this(