Skip to content

Commit

Permalink
feat: NoticeSearchDto에 hasAttachment 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
skfotakf committed Sep 1, 2023
1 parent 50ee14b commit c1f9589
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ class NoticeRepositoryImpl(

val noticeEntityList = jpaQuery.orderBy(noticeEntity.isPinned.desc())
.orderBy(noticeEntity.createdAt.desc())
.offset(20*pageNum) //로컬 테스트를 위해 잠시 5로 둘 것, 원래는 20
.offset(20*pageNum)
.limit(20)
.distinct()
.fetch()

val noticeSearchDtoList : List<NoticeSearchDto> = noticeEntityList.map {
val hasAttachment : Boolean = it.attachments.isNotEmpty()

NoticeSearchDto(
id = it.id,
title = it.title,
createdAt = it.createdAt,
isPinned = it.isPinned,
hasAttachment = hasAttachment
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ data class NoticeSearchDto @QueryProjection constructor(
val title: String,
val createdAt: LocalDateTime?,
val isPinned: Boolean,
val hasAttachment: Boolean,
) {

}

0 comments on commit c1f9589

Please sign in to comment.