From 0349facfe9026122f49a763c88770f67257027b0 Mon Sep 17 00:00:00 2001 From: KANG JISEOK Date: Sun, 12 May 2024 20:52:56 +0900 Subject: [PATCH 1/3] idea --- .idea/modules/webChat.main.iml | 5 +++++ .idea/modules/webChat.test.iml | 3 +++ 2 files changed, 8 insertions(+) diff --git a/.idea/modules/webChat.main.iml b/.idea/modules/webChat.main.iml index 8531a7c5..79f68e7d 100644 --- a/.idea/modules/webChat.main.iml +++ b/.idea/modules/webChat.main.iml @@ -4,6 +4,11 @@ + + + + + diff --git a/.idea/modules/webChat.test.iml b/.idea/modules/webChat.test.iml index 0d90cb2d..f83d1fad 100644 --- a/.idea/modules/webChat.test.iml +++ b/.idea/modules/webChat.test.iml @@ -10,6 +10,9 @@ + + + From 9c10fb67e1d412ebe008bd8b3d8391f5a2a6b0dc Mon Sep 17 00:00:00 2001 From: KANG JISEOK Date: Mon, 13 May 2024 18:07:19 +0900 Subject: [PATCH 2/3] =?UTF-8?q?fix=20:=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20api=20=EC=9D=91=EB=8B=B5=EB=A9=94=EC=84=B8=EC=A7=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webchat/error/ErrorCode.java | 19 +++------------ .../controller/FriendExceptionController.java | 3 +-- .../global/exception/ExceptionResponse.java | 12 ---------- .../controller/ExceptionController.java | 2 +- .../member/service/MemberServiceImpl.java | 2 ++ BackEnd/src/main/resources/application.yml | 23 ++++++++++--------- 6 files changed, 19 insertions(+), 42 deletions(-) diff --git a/BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java b/BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java index 5403cf84..c6455a12 100644 --- a/BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java @@ -9,29 +9,16 @@ public enum ErrorCode { // -----예외(Http 상태, 에러코드, 메시지)------ // // Member - EMAIL_ALREADY_TAKEN(400, "M001", "이미 존재하는 이메일입니다."), -// USER_NAME_NOT_FOUND(400, "M004", "해당 이름의 사용자를 찾을수 없습니다."), -// EMAIL_USER_NOT_FOUND(400, "M005", "해당 이메일의 사용자가 존재하지 않습니다."), -// EMAIL_EMPTY(400, "M007", "이메일을 입력해주세요."), - + EMAIL_ALREADY_TAKEN("이미 존재하는 이메일입니다."), //Friend - FRIEND_ALREADT_TAKEN(400, "M011", "이미 친구 요청을 보낸 상대입니다."); -// INVALID_LOGIN_INFO(400, "M009", "이메일 또는 비밀번호를 다시 확인해 주세요."), -// UNAUTHORIZED_USER(401, "M010", "로그인 후 이용가능합니다."), -// USER_EMPTY(400, "M011", "존재하지 않는 사용자입니다."), -// LOGIN_AGAIN(400, "M012", "로그인을 다시 시도해 주세요"); -// + FRIEND_ALREADT_TAKEN("이미 친구 요청을 보낸 상대입니다."); - private final int httpStatus; - private final String code; private final String message; - ErrorCode(final int httpStatus, final String code, final String message) { - this.httpStatus = httpStatus; - this.code = code; + ErrorCode(final String message) { this.message = message; } } diff --git a/BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendExceptionController.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendExceptionController.java index 0b2e04ff..b619e0ab 100644 --- a/BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendExceptionController.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendExceptionController.java @@ -16,8 +16,7 @@ public class FriendExceptionController { @ExceptionHandler(FriendDuplicationException.class) public ResponseEntity DataIntegrityViolationException(FriendDuplicationException e){ - log.info("DataIntegrityViolationException"); ExceptionResponse exceptionResponse = new ExceptionResponse(e.getErrorCode()); - return ResponseEntity.status(exceptionResponse.getStatus()).body(exceptionResponse); + return ResponseEntity.ok(exceptionResponse); } } diff --git a/BackEnd/src/main/java/springwebsocket/webchat/global/exception/ExceptionResponse.java b/BackEnd/src/main/java/springwebsocket/webchat/global/exception/ExceptionResponse.java index b02d96ba..80981dff 100644 --- a/BackEnd/src/main/java/springwebsocket/webchat/global/exception/ExceptionResponse.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/global/exception/ExceptionResponse.java @@ -4,24 +4,12 @@ import springwebsocket.webchat.error.ErrorCode; public class ExceptionResponse { - private final int status; - private final String code; private final String message; public ExceptionResponse(ErrorCode exceptionCode) { - this.status = exceptionCode.getHttpStatus(); - this.code = exceptionCode.getCode(); this.message = exceptionCode.getMessage(); } - public int getStatus() { - return status; - } - - public String getCode() { - return code; - } - public String getMessage() { return message; } diff --git a/BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java b/BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java index 9e3eca48..026accf4 100644 --- a/BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java @@ -15,6 +15,6 @@ public class ExceptionController { @ExceptionHandler(EmailDuplicatedException.class) public ResponseEntity EmailDuplicatedException(EmailDuplicatedException e) { ExceptionResponse exceptionResponse = new ExceptionResponse(e.getErrorCode()); - return ResponseEntity.status(exceptionResponse.getStatus()).body(exceptionResponse); + return ResponseEntity.ok(exceptionResponse); } } diff --git a/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceImpl.java b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceImpl.java index aebbb652..e5cfd2f1 100644 --- a/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceImpl.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceImpl.java @@ -53,7 +53,9 @@ public UserResponse signUp(SignUpRequest signUpRequest) { Member member = new Member(email, password, name, "ROLE_ADMIN"); try { memberRepository.save(member); + log.info("member ={}", member.getEmail()); } catch (DataIntegrityViolationException ex) { + log.info("DataIntegrityViolationException"); throw new EmailDuplicatedException(email); } diff --git a/BackEnd/src/main/resources/application.yml b/BackEnd/src/main/resources/application.yml index c9ac9b45..455124ac 100644 --- a/BackEnd/src/main/resources/application.yml +++ b/BackEnd/src/main/resources/application.yml @@ -11,22 +11,23 @@ springdoc: #SSL -server: - ssl: - key-store: file:/home/ubuntu/key/ssl/keystore.p12 - key-store-type: PKCS12 - key-store-password: 1234 +#server: +# ssl: +# key-store: file:/home/ubuntu/key/ssl/keystore.p12 +# key-store-type: PKCS12 +# key-store-password: 1234 #MySQL spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: ${MYSQL_DATABASE_URL} - username: ${MYSQL_DATABASE_USERNAME} - password: ${MYSQL_DATABASE_PASSWORD} - # url: "jdbc:mysql://localhost:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC" - # username: "springDB" - # password: + url: "jdbc:mysql://localhost:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC" + username: "springDB" + password: +# url: ${MYSQL_DATABASE_URL} +# username: ${MYSQL_DATABASE_USERNAME} +# password: ${MYSQL_DATABASE_PASSWORD} + jpa: show-sql: true hibernate: From 2ef7e50500092592176ee00556529f41768d0316 Mon Sep 17 00:00:00 2001 From: KANG JISEOK Date: Mon, 13 May 2024 18:12:53 +0900 Subject: [PATCH 3/3] =?UTF-8?q?fix=20:=20=EC=84=9C=EB=B2=84=20=EB=B0=B0?= =?UTF-8?q?=ED=8F=AC=EC=9A=A9=20application.yml=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackEnd/src/main/resources/application.yml | 23 +++++++++++----------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/BackEnd/src/main/resources/application.yml b/BackEnd/src/main/resources/application.yml index 455124ac..c9ac9b45 100644 --- a/BackEnd/src/main/resources/application.yml +++ b/BackEnd/src/main/resources/application.yml @@ -11,23 +11,22 @@ springdoc: #SSL -#server: -# ssl: -# key-store: file:/home/ubuntu/key/ssl/keystore.p12 -# key-store-type: PKCS12 -# key-store-password: 1234 +server: + ssl: + key-store: file:/home/ubuntu/key/ssl/keystore.p12 + key-store-type: PKCS12 + key-store-password: 1234 #MySQL spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver - url: "jdbc:mysql://localhost:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC" - username: "springDB" - password: -# url: ${MYSQL_DATABASE_URL} -# username: ${MYSQL_DATABASE_USERNAME} -# password: ${MYSQL_DATABASE_PASSWORD} - + url: ${MYSQL_DATABASE_URL} + username: ${MYSQL_DATABASE_USERNAME} + password: ${MYSQL_DATABASE_PASSWORD} + # url: "jdbc:mysql://localhost:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC" + # username: "springDB" + # password: jpa: show-sql: true hibernate: