-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: Add dto for total search of news. * Feat: Add repository for total search. * Feat: Add service, controller for news total search. * Fix: Fix conflict issues.
- Loading branch information
Showing
5 changed files
with
136 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/kotlin/com/wafflestudio/csereal/core/news/dto/NewsTotalSearchDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.wafflestudio.csereal.core.news.dto | ||
|
||
data class NewsTotalSearchDto ( | ||
val total: Int, | ||
val results: List<NewsTotalSearchElement> | ||
) |
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/com/wafflestudio/csereal/core/news/dto/NewsTotalSearchElement.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.wafflestudio.csereal.core.news.dto | ||
|
||
import com.wafflestudio.csereal.common.utils.substringAroundKeyword | ||
import java.time.LocalDateTime | ||
|
||
data class NewsTotalSearchElement private constructor( | ||
val id: Long, | ||
val title: String, | ||
val date: LocalDateTime?, | ||
val tags: List<String>, | ||
val imageUrl: String?, | ||
) { | ||
lateinit var partialDescription: String | ||
var boldStartIndex: Int = 0 | ||
var boldEndIndex: Int = 0 | ||
|
||
constructor( | ||
id: Long, | ||
title: String, | ||
date: LocalDateTime?, | ||
tags: List<String>, | ||
imageUrl: String?, | ||
description: String, | ||
keyword: String, | ||
amount: Int, | ||
) : this(id, title, date, tags, imageUrl) { | ||
val (startIdx, substring) = substringAroundKeyword(keyword, description, amount) | ||
partialDescription = substring | ||
boldStartIndex = startIdx ?: 0 | ||
boldEndIndex = startIdx?.plus(keyword.length) ?: 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters