-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into refactoring/#100/voice-room-data-save
- Loading branch information
Showing
33 changed files
with
587 additions
and
85 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
21 changes: 21 additions & 0 deletions
21
src/main/java/space/space_spring/config/filter/RequestCachingFilter.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 space.space_spring.config.filter; | ||
|
||
import jakarta.servlet.FilterChain; | ||
import jakarta.servlet.ServletException; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.filter.OncePerRequestFilter; | ||
import org.springframework.web.util.ContentCachingRequestWrapper; | ||
|
||
import java.io.IOException; | ||
@Component | ||
public class RequestCachingFilter extends OncePerRequestFilter { | ||
|
||
@Override | ||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) | ||
throws ServletException, IOException { | ||
ContentCachingRequestWrapper wrappedRequest = new ContentCachingRequestWrapper(request); | ||
filterChain.doFilter(wrappedRequest, response); | ||
} | ||
} |
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
6 changes: 4 additions & 2 deletions
6
...ig/UserSpaceValidationInterceptorURL.java โ ...RL/UserSpaceValidationInterceptorURL.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
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
56 changes: 56 additions & 0 deletions
56
src/main/java/space/space_spring/controller/LikeController.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,56 @@ | ||
package space.space_spring.controller; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.web.bind.annotation.*; | ||
import space.space_spring.argumentResolver.jwtLogin.JwtLoginAuth; | ||
import space.space_spring.response.BaseResponse; | ||
import space.space_spring.service.LikeService; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/space/{spaceId}/board/post/{postId}") | ||
@Slf4j | ||
public class LikeController { | ||
|
||
private final LikeService likeService; | ||
|
||
// ๊ฒ์๊ธ ์ข์์ | ||
@PostMapping("/like") | ||
public BaseResponse<String> likePost( | ||
@JwtLoginAuth Long userId, | ||
@PathVariable Long spaceId, | ||
@PathVariable Long postId | ||
) { | ||
// TODO 1: ์ ์ ๊ฐ ์คํ์ด์ค์ ์ํ๋์ง ๊ฒ์ฆ | ||
likeService.validateUserInSpace(userId, spaceId); | ||
|
||
// TODO 2: ์ ์ ๊ฐ ํด๋น ๊ฒ์๊ธ์ ์ด๋ฏธ ์ข์์๋ฅผ ๋๋ ๋์ง ๊ฒ์ฆ | ||
likeService.validateAlreadyLiked(userId, postId); | ||
|
||
// TODO 3: ์ข์์ ๋ก์ง ์ํ | ||
likeService.likePost(userId, postId); | ||
|
||
return new BaseResponse<>("๊ฒ์๊ธ์ ์ข์์๋ฅผ ๋๋ ์ต๋๋ค."); | ||
} | ||
|
||
|
||
// ๊ฒ์๊ธ ์ข์์ ์ทจ์ | ||
@DeleteMapping("/like") | ||
public BaseResponse<String> unlikePost( | ||
@JwtLoginAuth Long userId, | ||
@PathVariable Long spaceId, | ||
@PathVariable Long postId | ||
) { | ||
// TODO 1: ์ ์ ๊ฐ ์คํ์ด์ค์ ์ํ๋์ง ๊ฒ์ฆ | ||
likeService.validateUserInSpace(userId, spaceId); | ||
|
||
// TODO 2: ์ ์ ๊ฐ ํด๋น ๊ฒ์๊ธ์ ์ข์์๋ฅผ ๋๋ ๋์ง ๊ฒ์ฆ | ||
likeService.validateNotLikedYet(userId, postId); | ||
|
||
// TODO 3: ์ข์์ ์ทจ์ ๋ก์ง ์ํ | ||
likeService.unlikePost(userId, postId); | ||
|
||
return new BaseResponse<>("๊ฒ์๊ธ์ ์ข์์๋ฅผ ์ทจ์ํ์์ต๋๋ค."); | ||
} | ||
} |
Oops, something went wrong.