Skip to content

Commit

Permalink
fix: Logging 및 Controller 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
kkanggu committed Aug 21, 2023
1 parent 2a3e4ad commit e254688
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ExceptionHandler() {
"""
{
"request" : $requestInfo,
"code" : "${exception.errorCode}",
"code" : "${exception.errorCode.code}",
"message" : "${exception.errorCode.message}",
"status" : "$httpStatus"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class RequestLoggingFilter : OncePerRequestFilter() {

filterChain.doFilter(wrappedRequest, wrappedResponse)

wrappedResponse.copyBodyToResponse()
if (!(request.getAttribute("isLogged") as Boolean)) {
val requestInfo = makeRequestInfo(wrappedRequest)
val responseInfo = makeResponseInfo(wrappedResponse)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("/daitssu/community/article")
@RequestMapping("/community/article")
@Tag(name = "article", description = "커뮤니티 게시글 API")
class ArticleController(
private val articleService: ArticleService
Expand Down Expand Up @@ -46,4 +46,4 @@ class ArticleController(
@RequestBody articleWriteRequest: ArticleWriteRequest
): Response<ArticleResponse>
= Response(data = articleService.writeArticle(articleWriteRequest))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class ArticleControllerTest(
@DisplayName("article get controller test")
fun article_get_controller_test() {
// given
val baseUri = "/daitssu/community/article"
val baseUri = "/community/article"
val user = userRepository.findAll()[0]
val article: Article = Article(
topic = Topic.CHAT,
Expand All @@ -87,7 +87,7 @@ class ArticleControllerTest(
@DisplayName("article post 성공")
fun article_post_controller_success() {
// given
val baseUri = "/daitssu/community/article"
val baseUri = "/community/article"
val user = userRepository.findAll()[0]
val articleWriteRequest = ArticleWriteRequest(
topic = Topic.CHAT,
Expand Down Expand Up @@ -116,7 +116,7 @@ class ArticleControllerTest(
@DisplayName("article post nickname null")
fun article_post_nickname_null() {
// given
val baseUri = "/daitssu/community/article"
val baseUri = "/community/article"
val articleWriteRequest = ArticleWriteRequest(
topic = Topic.CHAT,
title = "테스트 제목",
Expand All @@ -135,4 +135,4 @@ class ArticleControllerTest(
).andExpect(jsonPath("$.code").value(ErrorCode.NICKNAME_REQUIRED.code))
.andExpect(jsonPath("$.message").value(ErrorCode.NICKNAME_REQUIRED.message))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ spring:
sql:
init:
schema-locations: classpath:/schema.sql
data-locations: classpath:/data.sql
# data-locations: classpath:/data.sql
Empty file removed src/test/resources/data.sql
Empty file.
6 changes: 3 additions & 3 deletions src/test/resources/schema.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CREATE SCHEMA main;
CREATE SCHEMA notice;
CREATE SCHEMA course;
CREATE SCHEMA IF NOT EXISTS main;
CREATE SCHEMA IF NOT EXISTS notice;
CREATE SCHEMA IF NOT EXISTS course;

0 comments on commit e254688

Please sign in to comment.