-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🚑 Interceptor 반환 데이터 변경 및 관련 코드 리팩토링
issue:#251
- Loading branch information
Showing
6 changed files
with
46 additions
and
31 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
2 changes: 2 additions & 0 deletions
2
src/main/java/com/depromeet/sulsul/domain/member/repository/MemberRepository.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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package com.depromeet.sulsul.domain.member.repository; | ||
|
||
import com.depromeet.sulsul.domain.member.entity.Member; | ||
import java.util.Optional; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface MemberRepository extends JpaRepository<Member, Long>, MemberRepositoryCustom { | ||
|
||
Long findLevelById(Long id); | ||
Optional<Member> findByIdAndDeletedAtIsNotNull(Long id); | ||
} |
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/depromeet/sulsul/util/HttpResponseUtil.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,26 @@ | ||
package com.depromeet.sulsul.util; | ||
|
||
import com.depromeet.sulsul.common.response.dto.ResponseDto; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import java.io.IOException; | ||
import javax.servlet.http.HttpServletResponse; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public class HttpResponseUtil { | ||
|
||
private static final ObjectMapper objectMapper = new ObjectMapper(); | ||
|
||
public static void processWithErrorResponseDto(String errorMessage, HttpStatus httpStatus, | ||
HttpServletResponse response) throws IOException { | ||
String responseBodyWithJson = objectMapper.writeValueAsString( | ||
ResponseDto.ERROR(errorMessage, httpStatus)); | ||
setResponseJsonType(response); | ||
response.getWriter().write(responseBodyWithJson); | ||
response.setStatus(httpStatus.value()); | ||
} | ||
|
||
public static void setResponseJsonType(HttpServletResponse response) { | ||
response.setContentType("application/json"); | ||
response.setCharacterEncoding("utf-8"); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -32,3 +32,9 @@ cloud: | |
bucket: sulsul-media-bucket | ||
stack: | ||
auto: false | ||
|
||
logging: | ||
level: | ||
org: | ||
hibernate: | ||
type: trace |