Skip to content

Commit 6b797fc

Browse files
authored
PostComment URL 수정 (#201)
1 parent dce5761 commit 6b797fc

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

back/src/main/java/com/back/domain/post/comment/controller/PostCommentController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
import java.util.List;
2222

2323
@RestController
24-
@RequestMapping("/post/comment")
24+
@RequestMapping("/post")
2525
@RequiredArgsConstructor
2626
public class PostCommentController {
2727

2828
private final Rq rq;
2929
private final PostCommentService postCommentService;
3030

3131
@Operation(summary = "댓글 생성", description = "comment는 공백이나 Null이 될 수 없습니다. comment의 글자 수 제한은 없습니다.")
32-
@PostMapping("/post/{post_id}")
32+
@PostMapping("/{post_id}/comment")
3333
public RsData<Void> createComment(@PathVariable Long post_id,
3434
@Valid @RequestBody CommentCreateRequest commentCreateRequest
3535
) {
@@ -47,7 +47,7 @@ public RsData<List<CommentAllResponse>> getAllPostComment(@PathVariable Long pos
4747
}
4848

4949
@Operation(summary = "댓글 삭제", description = "commentId는 공백이나 Null이 될 수 없습니다.")
50-
@DeleteMapping("/post/{post_id}/comment")
50+
@DeleteMapping("/{post_id}/comment")
5151
public RsData<Void> removePostComment(@PathVariable @Positive Long post_id
5252
, @RequestBody @Valid CommentDeleteRequest commentDeleteRequest) {
5353
Member member = rq.getActor();
@@ -58,7 +58,7 @@ public RsData<Void> removePostComment(@PathVariable @Positive Long post_id
5858
}
5959

6060
@Operation(summary = "댓글 수정", description = "commentId, content는 공백이나 Null이 될 수 없습니다. content의 글자 수 제한은 없습니다. ")
61-
@PutMapping("/post/{post_id}/comment/")
61+
@PutMapping("/{post_id}/comment")
6262
public RsData<Void> updatePostComment(@PathVariable Long post_id
6363
, @Valid @RequestBody CommentModifyRequest commentModifyRequest) {
6464
Member member = rq.getActor();

back/src/test/java/com/back/domain/post/comment/PostCommentControllerTest.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void setUp() {
7777
void t1() throws Exception {
7878
ResultActions resultActions = mvc
7979
.perform(
80-
post("/post/comment/post/{post_id}", 1L)
80+
post("/post/{post_id}/comment", 1L)
8181
.contentType(MediaType.APPLICATION_JSON)
8282
.content("""
8383
{
@@ -105,7 +105,7 @@ void t1() throws Exception {
105105
void t2() throws Exception {
106106
ResultActions resultActions = mvc
107107
.perform(
108-
post("/post/comment/post/{post_id}", 1L)
108+
post("/post/{post_id}/comment", 1L)
109109
.contentType(MediaType.APPLICATION_JSON)
110110
.content("""
111111
{
@@ -132,7 +132,7 @@ void t2() throws Exception {
132132
void t3() throws Exception {
133133
ResultActions resultActions = mvc
134134
.perform(
135-
get("/post/comment/post/{post_id}", 1L)
135+
get("/post/post/{post_id}", 1L)
136136
)
137137
.andDo(print());
138138

@@ -153,7 +153,7 @@ void t3() throws Exception {
153153
void t4() throws Exception {
154154
mvc
155155
.perform(
156-
post("/post/comment/post/{post_id}", 2L)
156+
post("/post/{post_id}/comment", 2L)
157157
.contentType(MediaType.APPLICATION_JSON)
158158
.content("""
159159
{
@@ -171,7 +171,7 @@ void t4() throws Exception {
171171
// 댓글 삭제
172172
ResultActions resultActions = mvc
173173
.perform(
174-
delete("/post/comment/post/{post_id}/comment", 2L) // URL 수정
174+
delete("/post/{post_id}/comment", 2L) // URL 수정
175175
.contentType(MediaType.APPLICATION_JSON) // Content-Type 추가
176176
.content("""
177177
{
@@ -194,7 +194,7 @@ void t4() throws Exception {
194194
void t5() throws Exception {
195195
ResultActions resultActions = mvc
196196
.perform(
197-
delete("/post/comment/post/{post_id}/comment", 1L) // URL 수정
197+
delete("/post/{post_id}/comment", 1L) // URL 수정
198198
.contentType(MediaType.APPLICATION_JSON)
199199
.content("""
200200
{
@@ -217,7 +217,7 @@ void t5() throws Exception {
217217
void t6() throws Exception {
218218
mvc
219219
.perform(
220-
post("/post/comment/post/{post_id}", 2L)
220+
post("/post/{post_id}/comment", 2L)
221221
.contentType(MediaType.APPLICATION_JSON)
222222
.content("""
223223
{
@@ -232,7 +232,7 @@ void t6() throws Exception {
232232

233233
ResultActions resultActions = mvc
234234
.perform(
235-
put("/post/comment/post/{post_id}/comment/", 2L)
235+
put("/post/{post_id}/comment", 2L)
236236
.contentType(MediaType.APPLICATION_JSON)
237237
.content("""
238238
{
@@ -255,7 +255,7 @@ void t6() throws Exception {
255255
void t7() throws Exception {
256256
ResultActions resultActions = mvc
257257
.perform(
258-
put("/post/comment/post/{post_id}/comment/", 1L)
258+
put("/post/{post_id}/comment", 1L)
259259
.contentType(MediaType.APPLICATION_JSON)
260260
.content("""
261261
{
@@ -278,7 +278,7 @@ void t7() throws Exception {
278278
void t8() throws Exception {
279279
ResultActions resultActions = mvc
280280
.perform(
281-
put("/post/comment/post/{post_id}/comment/", 1L)
281+
put("/post/{post_id}/comment", 1L)
282282
.contentType(MediaType.APPLICATION_JSON)
283283
.content("""
284284
{

0 commit comments

Comments
 (0)