Skip to content

Commit

Permalink
[FEAT] 검색 API #24
Browse files Browse the repository at this point in the history
  • Loading branch information
dl-00-e8 committed Feb 8, 2023
1 parent 3b2bc09 commit 23a5969
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 0 deletions.
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);
}
}
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;
}
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 {
}
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 {
}
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;
}
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> {

}
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;
}


}

0 comments on commit 23a5969

Please sign in to comment.