-
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.
Merge pull request #381 from daedongbread/develop
대동빵 2.0.0
- Loading branch information
Showing
135 changed files
with
5,221 additions
and
496 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
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
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
29 changes: 29 additions & 0 deletions
29
...java/com/depromeet/breadmapbackend/domain/admin/openSearch/OpenSearchAdminController.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,29 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.openSearch; | ||
|
||
import com.depromeet.breadmapbackend.domain.admin.openSearch.dto.request.OpenSearchCreateIndexRequest; | ||
import com.depromeet.breadmapbackend.domain.admin.openSearch.dto.response.OpenSearchCreateIndexResponse; | ||
import com.depromeet.breadmapbackend.domain.search.OpenSearchService; | ||
import com.depromeet.breadmapbackend.global.dto.ApiResponse; | ||
import com.depromeet.breadmapbackend.global.exception.ValidationSequence; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import javax.validation.Valid; | ||
import java.io.IOException; | ||
|
||
@Validated(ValidationSequence.class) | ||
@RestController | ||
@RequestMapping("/v1/admin/search-engine") | ||
@RequiredArgsConstructor | ||
public class OpenSearchAdminController { | ||
private final OpenSearchService openSearchService; | ||
|
||
@PostMapping | ||
@ResponseStatus(HttpStatus.OK) | ||
public ApiResponse<OpenSearchCreateIndexResponse> createIndex( | ||
@Valid @RequestBody OpenSearchCreateIndexRequest createIndexRequest) throws IOException { | ||
return new ApiResponse<>(openSearchService.deleteAndCreateIndex(createIndexRequest.getIndexName().toLowerCase())); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...main/java/com/depromeet/breadmapbackend/domain/admin/openSearch/dto/KeywordSearchDto.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,14 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.openSearch.dto; | ||
|
||
import com.depromeet.breadmapbackend.domain.user.User; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class KeywordSearchDto { | ||
private User user; | ||
private String keyword; | ||
} |
9 changes: 9 additions & 0 deletions
9
...eet/breadmapbackend/domain/admin/openSearch/dto/request/OpenSearchCreateIndexRequest.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,9 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.openSearch.dto.request; | ||
|
||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
@Getter | ||
@NoArgsConstructor | ||
public class OpenSearchCreateIndexRequest { | ||
String indexName; | ||
} |
13 changes: 13 additions & 0 deletions
13
...t/breadmapbackend/domain/admin/openSearch/dto/response/OpenSearchCreateIndexResponse.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,13 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.openSearch.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class OpenSearchCreateIndexResponse { | ||
|
||
private String message; | ||
|
||
public OpenSearchCreateIndexResponse(String message) { | ||
this.message = message; | ||
} | ||
} |
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
68 changes: 68 additions & 0 deletions
68
...ain/java/com/depromeet/breadmapbackend/domain/admin/search/AdminHotKeywordController.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,68 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.search; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.http.HttpStatus; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.ResponseStatus; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import com.depromeet.breadmapbackend.domain.admin.search.dto.HotKeywordResponse; | ||
import com.depromeet.breadmapbackend.domain.admin.search.dto.HotKeywordUpdateRequest; | ||
import com.depromeet.breadmapbackend.domain.admin.search.dto.KeywordStatResponse; | ||
import com.depromeet.breadmapbackend.global.dto.ApiResponse; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
|
||
/** | ||
* AdminSearchKeywordController | ||
* | ||
* @author jaypark | ||
* @version 1.0.0 | ||
* @since 11/10/23 | ||
*/ | ||
|
||
@RestController | ||
@RequestMapping("/v1/admin/search/hot-keywords") | ||
@RequiredArgsConstructor | ||
public class AdminHotKeywordController { | ||
|
||
private final AdminHotKeywordService adminHotKeywordService; | ||
|
||
@GetMapping | ||
ApiResponse<List<KeywordStatResponse>> getHotKeywordsByKeyword( | ||
@RequestParam(name = "sortType", required = false, defaultValue = "THREE_MONTH") String sortType | ||
) { | ||
return new ApiResponse<>( | ||
adminHotKeywordService.getHotKeywords(SortType.valueOf(sortType.toUpperCase())) | ||
.stream() | ||
.map(Mapper::of) | ||
.toList() | ||
); | ||
} | ||
|
||
@GetMapping("/rank") | ||
ApiResponse<List<HotKeywordResponse>> getHotKeywords() { | ||
return new ApiResponse<>( | ||
adminHotKeywordService.getHotKeywordsRanking() | ||
.stream() | ||
.map(Mapper::of) | ||
.toList() | ||
); | ||
} | ||
|
||
@PutMapping("/rank") | ||
@ResponseStatus(HttpStatus.ACCEPTED) | ||
void updateHotKeywords(@RequestBody HotKeywordUpdateRequest request) { | ||
adminHotKeywordService.updateHotKeywordsRanking( | ||
request.HotKeywordList() | ||
.stream() | ||
.map(HotKeywordUpdateRequest.HotKeywordInfo::toEntity) | ||
.toList() | ||
); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/main/java/com/depromeet/breadmapbackend/domain/admin/search/AdminHotKeywordService.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,19 @@ | ||
package com.depromeet.breadmapbackend.domain.admin.search; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* AdminHotKeywordService | ||
* | ||
* @author jaypark | ||
* @version 1.0.0 | ||
* @since 11/10/23 | ||
*/ | ||
public interface AdminHotKeywordService { | ||
List<Keyword> getHotKeywords(SortType sortType); | ||
|
||
List<HotKeyword> getHotKeywordsRanking(); | ||
|
||
void updateHotKeywordsRanking(List<HotKeyword> hotKeywords); | ||
|
||
} |
Oops, something went wrong.