Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
authorizeRequests
.requestMatchers("/signup").permitAll()
.requestMatchers("/login").permitAll()
.requestMatchers("/searches").permitAll()
.requestMatchers("/swagger-ui/**").permitAll()
.requestMatchers("/**").permitAll()
.anyRequest().authenticated()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
import java.util.List;

public interface SearchService {
List<ReadSearchResponse> findUserAndGoal(ReadSearchRequest request);
List<ReadSearchResponse> findUserAndGoal(int userId, ReadSearchRequest request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class SearchServiceImpl implements SearchService {
private static final int NOT_FOUND = 404;

@Override
public List<ReadSearchResponse> findUserAndGoal(ReadSearchRequest request) {
public List<ReadSearchResponse> findUserAndGoal(int userId, ReadSearchRequest request) {
String searchField = request.searchField();
String keyword = request.keyword();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;

import java.util.List;

Expand All @@ -32,8 +29,10 @@ public class SearchController {
})
@GetMapping
public Response<List<ReadSearchResponse>> getSearch(
@Valid @RequestBody ReadSearchRequest request
@AuthenticationPrincipal CustomUserDetails userDetails,
@Valid @ModelAttribute ReadSearchRequest request
){
return Response.ok(searchService.findUserAndGoal(request));
int userId = userDetails.getUserId();
return Response.ok(searchService.findUserAndGoal(userId, request));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private void processExceptionHandle(HttpServletResponse response, ErrorStatus er
*/
@Override
protected boolean shouldNotFilter(HttpServletRequest request) throws ServletException {
String[] excludedPaths = {"/api/v1/auths/signup", "/api/v1/auths/login", "/api/v1/searches", "/v3/**", "/swagger-ui/**"};
String[] excludedPaths = {"/api/v1/auths/signup", "/api/v1/auths/login", "/v3/**", "/swagger-ui/**"};
AntPathMatcher antPathMatcher = new AntPathMatcher();

for (String excludedPath : excludedPaths) {
Expand Down
Loading