-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/com/mews/mews_backend/api/search/controller/SearchController.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,25 @@ | ||
package com.mews.mews_backend.api.search.controller; | ||
|
||
import com.mews.mews_backend.api.search.dto.response.PostSearchRes; | ||
import io.swagger.annotations.Api; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@Api(tags = {"Mews Search API"}) | ||
@RequestMapping("/search") | ||
public class SearchController { | ||
|
||
@PostMapping(value = "/{keyword}") | ||
public ResponseEntity<PostSearchRes> Search(@PathVariable ("keyword") String string) { | ||
PostSearchRes postSearchRes = new PostSearchRes(); | ||
|
||
|
||
return ResponseEntity.ok(postSearchRes); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/mews/mews_backend/api/search/dto/request/PostSearchReq.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,18 @@ | ||
package com.mews.mews_backend.api.search.dto.request; | ||
|
||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import javax.validation.constraints.NotBlank; | ||
|
||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
public class PostSearchReq { | ||
|
||
@NotBlank | ||
@ApiModelProperty(notes = "검색 키워드", example = "작성자") | ||
private String keyword; | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/mews/mews_backend/api/search/dto/response/PostArticleRes.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,7 @@ | ||
package com.mews.mews_backend.api.search.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PostArticleRes { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/mews/mews_backend/api/search/dto/response/PostEditorRes.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,7 @@ | ||
package com.mews.mews_backend.api.search.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
@Getter | ||
public class PostEditorRes { | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/mews/mews_backend/api/search/dto/response/PostSearchRes.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.mews.mews_backend.api.search.dto.response; | ||
|
||
import lombok.Getter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
public class PostSearchRes { | ||
|
||
private List<PostArticleRes> postArticleRes; | ||
|
||
private List<PostSearchRes> postSearchRes; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/mews/mews_backend/domain/search/repository/SearchRepository.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.mews.mews_backend.domain.search.repository; | ||
|
||
import com.mews.mews_backend.domain.calendar.entity.Calendar; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories; | ||
import org.springframework.stereotype.Repository; | ||
|
||
|
||
@Repository | ||
@EnableJpaRepositories | ||
public interface SearchRepository extends JpaRepository<Calendar, Integer> { | ||
|
||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/mews/mews_backend/domain/search/service/SearchService.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,21 @@ | ||
package com.mews.mews_backend.domain.search.service; | ||
|
||
import com.mews.mews_backend.domain.search.repository.SearchRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.stereotype.Service; | ||
|
||
import javax.transaction.Transactional; | ||
|
||
@Service | ||
@Transactional | ||
public class SearchService { | ||
|
||
private final SearchRepository searchRepository; | ||
|
||
@Autowired | ||
public SearchService(SearchRepository searchRepository) { | ||
this.searchRepository = searchRepository; | ||
} | ||
|
||
|
||
} |