From 2f7a656ffb1fe780511592501758920277b92a9f Mon Sep 17 00:00:00 2001 From: Lee junbeom Date: Sun, 30 Jun 2024 00:02:27 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=BD=83=20=EC=84=A0=ED=83=9D=20?= =?UTF-8?q?=EC=8B=9C=20=EC=B6=94=EC=B2=9C=20=EB=A9=98=ED=8A=B8=EC=99=80=20?= =?UTF-8?q?=ED=95=A8=EA=BB=98=20=EC=96=B4=EC=9A=B8=EB=A6=AC=EB=8A=94=20?= =?UTF-8?q?=EA=BD=83=20=EB=B0=98=ED=99=98=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inputMessage/controller/ModelController.java | 15 ++++++++++++++- .../inputMessage/controller/api/ModelApi.java | 9 +++++++++ .../global/security/config/SecurityConfig.java | 2 +- .../global/security/filter/JwtVerifyFilter.java | 2 +- 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/fiurinee/domain/inputMessage/controller/ModelController.java b/src/main/java/com/example/fiurinee/domain/inputMessage/controller/ModelController.java index ac8aa5f..4bdb321 100644 --- a/src/main/java/com/example/fiurinee/domain/inputMessage/controller/ModelController.java +++ b/src/main/java/com/example/fiurinee/domain/inputMessage/controller/ModelController.java @@ -92,7 +92,20 @@ public ResponseEntity selectFlower(@PathVariable ("m re.add(responseHarmonyDto0); re.add(responseHarmonyDto1); - return ResponseEntity.ok(new ResponseHarmonyWitnMentDto("추천 멘트",re)); + return ResponseEntity.ok(new ResponseHarmonyWitnMentDto("추천은 recommend, recommend는 영어로 추천, 내 너무 피곤하다,, 인생이란 뭘까",re)); + } + + @PostMapping("/{flowerId}/non") + public ResponseEntity selectFlowerNonMember(@PathVariable ("flowerId") Long flowerId, + @RequestBody String ment){ + ResponseHarmonyDto responseHarmonyDto0 = new ResponseHarmonyDto(flowerService.findByNameAndFlowerLanguage("토마토", "완성된 아름다움")); + ResponseHarmonyDto responseHarmonyDto1 = new ResponseHarmonyDto(flowerService.findByNameAndFlowerLanguage("토레니아", "가련한 욕망")); + + List re = new ArrayList<>(); + re.add(responseHarmonyDto0); + re.add(responseHarmonyDto1); + + return ResponseEntity.ok(new ResponseHarmonyWitnMentDto("추천은 recommend, recommend는 영어로 추천, 내 너무 피곤하다,, 인생이란 뭘까",re)); } @PostMapping("/test") diff --git a/src/main/java/com/example/fiurinee/domain/inputMessage/controller/api/ModelApi.java b/src/main/java/com/example/fiurinee/domain/inputMessage/controller/api/ModelApi.java index 90c3c91..5e6ba7f 100644 --- a/src/main/java/com/example/fiurinee/domain/inputMessage/controller/api/ModelApi.java +++ b/src/main/java/com/example/fiurinee/domain/inputMessage/controller/api/ModelApi.java @@ -64,5 +64,14 @@ public ResponseEntity> inputMent(@Parameter(description = public ResponseEntity selectFlower(@Parameter(description = "회원의 아이디") @PathVariable ("memberId") Long memberId, @Parameter(description = "선택한 꽃의 아이디") @PathVariable ("flowerId") Long flowerId, @Parameter(description = "입력했던 멘트") @RequestBody String ment); + @Operation( + summary = "비회원 사용자가 꽃을 선택했을 시 호출", + description = "꽃을 선택했을 시 선택한 꽃의 id 그리고 이전에 입력했던 사용자의 멘트를 보내주세요", + security = @SecurityRequirement(name = "bearerAuth") + ) + @ApiResponse(responseCode = "200", description = "멘트 추천 및 어울리는 꽃 추천 성공") + @PostMapping("/{flowerId}/non") + public ResponseEntity selectFlowerNonMember(@Parameter(description = "꽃의 아이디") @PathVariable ("flowerId") Long flowerId, + @Parameter(description = "회원이 입력 했던 멘트") @RequestBody String ment); } diff --git a/src/main/java/com/example/fiurinee/global/security/config/SecurityConfig.java b/src/main/java/com/example/fiurinee/global/security/config/SecurityConfig.java index 9431234..4828080 100644 --- a/src/main/java/com/example/fiurinee/global/security/config/SecurityConfig.java +++ b/src/main/java/com/example/fiurinee/global/security/config/SecurityConfig.java @@ -71,7 +71,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti .requestMatchers("/oauth2/login", "/login/oauth2/code/**", "/oauth2/authorization/**","/login/oauth2/code/google","/member/*/refresh","/model/test", "/swagger-ui/index.html", "/swagger-ui/**", "/v3/api-docs/**","/swagger-resources/**", "/v3/api-docs").permitAll() //비회원 전용 api - .requestMatchers("/main/today","/main/season","model/ment").permitAll() + .requestMatchers("/main/today","/main/season","/model/ment","/model/*/non").permitAll() .anyRequest().authenticated()); http.addFilterBefore(jwtVerifyFilter(), UsernamePasswordAuthenticationFilter.class); diff --git a/src/main/java/com/example/fiurinee/global/security/filter/JwtVerifyFilter.java b/src/main/java/com/example/fiurinee/global/security/filter/JwtVerifyFilter.java index 783a204..938876c 100644 --- a/src/main/java/com/example/fiurinee/global/security/filter/JwtVerifyFilter.java +++ b/src/main/java/com/example/fiurinee/global/security/filter/JwtVerifyFilter.java @@ -29,7 +29,7 @@ public class JwtVerifyFilter extends OncePerRequestFilter { //Swagger "/swagger-ui/index.html", "/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**", "/v3/api-docs", //비회원 전용 api - "/main/today","/main/season","/model/ment"}; + "/main/today","/main/season","/model/ment","/model/*/non"}; private final RedisUtil redisUtil;