-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feat/#26
- Loading branch information
Showing
38 changed files
with
533 additions
and
24 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
30 changes: 30 additions & 0 deletions
30
module-api/src/main/java/com/mile/controller/moim/MoimController.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,30 @@ | ||
package com.mile.controller.moim; | ||
|
||
import com.mile.dto.SuccessResponse; | ||
import com.mile.exception.message.SuccessMessage; | ||
import com.mile.moim.serivce.MoimService; | ||
import com.mile.moim.serivce.dto.ContentListResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.security.Principal; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/moim") | ||
public class MoimController implements MoimControllerSwagger { | ||
|
||
private final MoimService moimService; | ||
|
||
@GetMapping("/{moimId}") | ||
@Override | ||
public SuccessResponse<ContentListResponse> getTopicsFromMoim( | ||
@PathVariable final Long moimId, | ||
final Principal principal | ||
) { | ||
return SuccessResponse.of(SuccessMessage.TOPIC_SEARCH_SUCCESS, moimService.getContentsFromMoim(moimId, Long.valueOf(principal.getName()))); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
module-api/src/main/java/com/mile/controller/moim/MoimControllerSwagger.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,34 @@ | ||
package com.mile.controller.moim; | ||
|
||
import com.mile.dto.ErrorResponse; | ||
import com.mile.dto.SuccessResponse; | ||
import com.mile.moim.serivce.dto.ContentListResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
|
||
import java.security.Principal; | ||
|
||
@Tag(name = "Moim", description = "모임 관련 API") | ||
public interface MoimControllerSwagger { | ||
@Operation(summary = "에디터 상단 글감 조회") | ||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "글감 조회가 완료되었습니다."), | ||
@ApiResponse(responseCode = "403", description = "해당 사용자는 모임에 접근 권한이 없습니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "404", description = "해당 모임의 주제가 존재하지 않습니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
} | ||
) | ||
SuccessResponse<ContentListResponse> getTopicsFromMoim( | ||
@PathVariable final Long moimId, | ||
final Principal principal | ||
); | ||
} |
38 changes: 38 additions & 0 deletions
38
module-api/src/main/java/com/mile/controller/post/PostController.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,38 @@ | ||
package com.mile.controller.post; | ||
|
||
import com.mile.dto.SuccessResponse; | ||
import com.mile.exception.message.SuccessMessage; | ||
import com.mile.post.service.PostService; | ||
import com.mile.post.service.dto.CommentCreateRequest; | ||
import jakarta.validation.Valid; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.security.Principal; | ||
|
||
@RestController | ||
@RequestMapping("/api/post") | ||
@RequiredArgsConstructor | ||
public class PostController implements PostControllerSwagger{ | ||
|
||
private final PostService postService; | ||
|
||
@PostMapping("/{postId}/comment") | ||
@Override | ||
public SuccessResponse postComment( | ||
@PathVariable final Long postId, | ||
@Valid @RequestBody final CommentCreateRequest commentCreateRequest, | ||
final Principal principal | ||
) { | ||
postService.createCommentOnPost( | ||
postId, | ||
Long.valueOf(principal.getName()), | ||
commentCreateRequest | ||
); | ||
return SuccessResponse.of(SuccessMessage.COMMENT_CREATE_SUCCESS); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
module-api/src/main/java/com/mile/controller/post/PostControllerSwagger.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,40 @@ | ||
package com.mile.controller.post; | ||
|
||
import com.mile.dto.ErrorResponse; | ||
import com.mile.dto.SuccessResponse; | ||
import com.mile.post.service.dto.CommentCreateRequest; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.media.Content; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
|
||
import java.security.Principal; | ||
|
||
@Tag(name = "Post", description = "게시글 관련 API - 댓글 등록/ 조회 포함") | ||
public interface PostControllerSwagger { | ||
|
||
@Operation(summary = "댓글 작성") | ||
@ApiResponses( | ||
value = { | ||
@ApiResponse(responseCode = "200", description = "댓글 등록이 완료되었습니다."), | ||
@ApiResponse(responseCode = "400", | ||
description = "1. 댓글 최대 입력 길이(500자)를 초과하였습니다.\n" + | ||
"2.댓글에 내용이 없습니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "403", description = "해당 사용자는 모임에 접근 권한이 없습니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))), | ||
@ApiResponse(responseCode = "500", description = "서버 내부 오류입니다.", | ||
content = @Content(schema = @Schema(implementation = ErrorResponse.class))) | ||
} | ||
) | ||
SuccessResponse postComment( | ||
@PathVariable final Long postId, | ||
@Valid @RequestBody final CommentCreateRequest commentCreateRequest, | ||
final Principal principal | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.mile; | ||
|
||
import org.springframework.boot.test.context.SpringBootTest; | ||
|
||
@SpringBootTest | ||
class ApiApplicationTests { | ||
} |
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
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
9 changes: 9 additions & 0 deletions
9
module-common/src/main/java/com/mile/exception/model/ForbiddenException.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,9 @@ | ||
package com.mile.exception.model; | ||
|
||
import com.mile.exception.message.ErrorMessage; | ||
|
||
public class ForbiddenException extends MileException { | ||
public ForbiddenException(final ErrorMessage errorMessage) { | ||
super(errorMessage); | ||
} | ||
} |
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
Oops, something went wrong.