-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #278 from sharemindteam/feature/277-admin-search-word
feat: 검색어 확인하는 어드민 기능 구현
- Loading branch information
Showing
7 changed files
with
80 additions
and
0 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
46 changes: 46 additions & 0 deletions
46
src/main/java/com/example/sharemind/admin/dto/response/SearchWordGetResponse.java
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,46 @@ | ||
package com.example.sharemind.admin.dto.response; | ||
|
||
import com.example.sharemind.searchWord.domain.SearchWord; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.time.LocalDateTime; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class SearchWordGetResponse { | ||
|
||
@Schema(description = "검색어 아이디") | ||
private final Long wordId; | ||
|
||
@Schema(description = "검색어") | ||
private final String word; | ||
|
||
@Schema(description = "검색 횟수") | ||
private final Long count; | ||
|
||
@Schema(description = "최초 검색 일시") | ||
private final LocalDateTime createdAt; | ||
|
||
@Schema(description = "마지막 검색 일시") | ||
private final LocalDateTime updatedAt; | ||
|
||
@Builder | ||
public SearchWordGetResponse(Long wordId, String word, Long count, LocalDateTime createdAt, | ||
LocalDateTime updatedAt) { | ||
this.wordId = wordId; | ||
this.word = word; | ||
this.count = count; | ||
this.createdAt = createdAt; | ||
this.updatedAt = updatedAt; | ||
} | ||
|
||
public static SearchWordGetResponse of(SearchWord searchWord) { | ||
return SearchWordGetResponse.builder() | ||
.wordId(searchWord.getWordId()) | ||
.word(searchWord.getWord()) | ||
.count(searchWord.getCount()) | ||
.createdAt(searchWord.getCreatedAt()) | ||
.updatedAt(searchWord.getUpdatedAt()) | ||
.build(); | ||
} | ||
} |
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
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
3 changes: 3 additions & 0 deletions
3
src/main/java/com/example/sharemind/searchWord/repository/SearchWordRepository.java
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 |
---|---|---|
@@ -1,11 +1,14 @@ | ||
package com.example.sharemind.searchWord.repository; | ||
|
||
import com.example.sharemind.searchWord.domain.SearchWord; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface SearchWordRepository extends JpaRepository<SearchWord, Long> { | ||
Optional<SearchWord> findByWordAndIsActivatedTrue(String word); | ||
|
||
List<SearchWord> findAllByOrderByCountDesc(); | ||
} |