From b2635f7fb9046a4309e365a84b9f8bac54085267 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Wed, 18 Sep 2024 03:21:42 +0900 Subject: [PATCH 1/9] =?UTF-8?q?Fix:=20OB-=EC=A4=91=EB=85=84=EC=B8=B5,=20YB?= =?UTF-8?q?-=EC=96=B4=EB=A6=B0=EC=B8=B5=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/gt/genti/openchat/model/OpenChatType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java b/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java index 7007f2d2..aa10e5b2 100644 --- a/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java +++ b/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java @@ -9,8 +9,8 @@ @Getter @RequiredArgsConstructor public enum OpenChatType implements ConvertableEnum { - OB("OB", "어린층"), - YB("YB", "중년층"); + OB("OB", "중년층"), + YB("YB", "어린층"); private final String stringValue; private final String response; From 7afb13a35b5bf479bcc0c0df7634aa3034a397b8 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <122717063+LeeJae-H@users.noreply.github.com> Date: Wed, 18 Sep 2024 03:24:52 +0900 Subject: [PATCH 2/9] =?UTF-8?q?Fix:=20OpenChatType=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/gt/genti/openchat/model/OpenChatType.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java b/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java index aa10e5b2..87b3817f 100644 --- a/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java +++ b/genti-domain/src/main/java/com/gt/genti/openchat/model/OpenChatType.java @@ -9,8 +9,8 @@ @Getter @RequiredArgsConstructor public enum OpenChatType implements ConvertableEnum { - OB("OB", "중년층"), - YB("YB", "어린층"); + OB("OB", "OB"), + YB("YB", "YB"); private final String stringValue; private final String response; From e5f448947f54481953866b6c55be70a4b6a56bc7 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Thu, 26 Sep 2024 17:02:12 +0900 Subject: [PATCH 3/9] =?UTF-8?q?Fix:=20#166=20S3=20FileType=20=EA=B0=92=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-api/src/main/resources/file-appender.xml | 2 +- .../src/main/java/com/gt/genti/aws/FileType.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/genti-api/src/main/resources/file-appender.xml b/genti-api/src/main/resources/file-appender.xml index 6d2f1f41..fec722d3 100644 --- a/genti-api/src/main/resources/file-appender.xml +++ b/genti-api/src/main/resources/file-appender.xml @@ -1,6 +1,6 @@ - /logs/genti-%d{yyyy-MM-dd}.log + logs/genti-%d{yyyy-MM-dd}.log 90 diff --git a/genti-external/src/main/java/com/gt/genti/aws/FileType.java b/genti-external/src/main/java/com/gt/genti/aws/FileType.java index 105b71f6..db94d459 100644 --- a/genti-external/src/main/java/com/gt/genti/aws/FileType.java +++ b/genti-external/src/main/java/com/gt/genti/aws/FileType.java @@ -8,7 +8,13 @@ public enum FileType { CREATED_IMAGE("CREATED_IMAGE"), ADMIN_UPLOADED_IMAGE("ADMIN_UPLOADED_IMAGE"), - USER_UPLOADED_IMAGE("USER_UPLOADED_IMAGE"); + USER_UPLOADED_IMAGE("USER_UPLOADED_IMAGE"), + USER_VERIFICATION_IMAGE("USER_VERIFICATION_IMAGE"), + + DEV_CREATED_IMAGE("DEV/CREATED_IMAGE"), + DEV_ADMIN_UPLOADED_IMAGE("DEV/ADMIN_UPLOADED_IMAGE"), + DEV_USER_UPLOADED_IMAGE("DEV/USER_UPLOADED_IMAGE"), + DEV_USER_VERIFICATION_IMAGE("DEV/USER_VERIFICATION_IMAGE"); private final String stringValue; } From 208839206683b53596108faeb1be0dad6b29efde Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Thu, 26 Sep 2024 19:50:44 +0900 Subject: [PATCH 4/9] =?UTF-8?q?Feat:=20#166=20=EB=B3=B8=EC=9D=B8=EC=9D=B8?= =?UTF-8?q?=EC=A6=9D=EC=97=AC=EB=B6=80=ED=99=95=EC=9D=B8=20api,=20s3key=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=20api=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/UserVerificationApi.java | 35 +++++++++++++++ .../UserVerificationController.java | 35 +++++++++++++++ .../request/UserVerificationRequestDto.java | 16 +++++++ .../service/UserVerificationService.java | 44 +++++++++++++++++++ .../model/PictureUserVerification.java | 25 +++++++++++ .../PictureUserVerificationRepository.java | 8 ++++ .../java/com/gt/genti/user/model/User.java | 5 +++ 7 files changed, 168 insertions(+) create mode 100644 genti-api/src/main/java/com/gt/genti/userverification/api/UserVerificationApi.java create mode 100644 genti-api/src/main/java/com/gt/genti/userverification/controller/UserVerificationController.java create mode 100644 genti-api/src/main/java/com/gt/genti/userverification/dto/request/UserVerificationRequestDto.java create mode 100644 genti-api/src/main/java/com/gt/genti/userverification/service/UserVerificationService.java create mode 100644 genti-domain/src/main/java/com/gt/genti/picture/userverification/model/PictureUserVerification.java create mode 100644 genti-domain/src/main/java/com/gt/genti/picture/userverification/repository/PictureUserVerificationRepository.java diff --git a/genti-api/src/main/java/com/gt/genti/userverification/api/UserVerificationApi.java b/genti-api/src/main/java/com/gt/genti/userverification/api/UserVerificationApi.java new file mode 100644 index 00000000..8cf6cbb9 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/userverification/api/UserVerificationApi.java @@ -0,0 +1,35 @@ +package com.gt.genti.userverification.api; + +import com.gt.genti.error.ResponseCode; +import com.gt.genti.response.GentiResponse.ApiResult; +import com.gt.genti.swagger.AuthorizedUser; +import com.gt.genti.swagger.EnumResponse; +import com.gt.genti.swagger.EnumResponses; +import com.gt.genti.user.model.AuthUser; +import com.gt.genti.userverification.dto.request.UserVerificationRequestDto; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; + +@AuthorizedUser +@Tag(name = "[UserVerificationController] 유저 본인 인증 컨트롤러", description = "유저의 본인 인증 수행 및 본인 인증 여부를 확인합니다.") +public interface UserVerificationApi { + + @Operation(summary = "본인인증여부확인", description = "유저의 본인 인증 여부를 조회합니다.") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK), + @EnumResponse(ResponseCode.UserNotFound) + }) + ResponseEntity> checkUserVerification( + @AuthUser Long userId); + + @Operation(summary = "본인인증수행", description = "본인인증사진 저장 및 본인인증변경여부를 수정합니다.") + @EnumResponses(value = { + @EnumResponse(ResponseCode.OK), + @EnumResponse(ResponseCode.UserNotFound) + }) + ResponseEntity> savePictureUserVerification( + @AuthUser Long userId, + @RequestBody UserVerificationRequestDto userVerificationRequestDto); +} diff --git a/genti-api/src/main/java/com/gt/genti/userverification/controller/UserVerificationController.java b/genti-api/src/main/java/com/gt/genti/userverification/controller/UserVerificationController.java new file mode 100644 index 00000000..2715fec7 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/userverification/controller/UserVerificationController.java @@ -0,0 +1,35 @@ +package com.gt.genti.userverification.controller; + +import com.gt.genti.response.GentiResponse; +import com.gt.genti.response.GentiResponse.ApiResult; +import com.gt.genti.user.model.AuthUser; +import com.gt.genti.userverification.api.UserVerificationApi; +import com.gt.genti.userverification.dto.request.UserVerificationRequestDto; +import com.gt.genti.userverification.service.UserVerificationService; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@RestController +@RequestMapping("/api/v1/user-verification") +@RequiredArgsConstructor +public class UserVerificationController implements UserVerificationApi { + + private final UserVerificationService userVerificationService; + + @GetMapping + public ResponseEntity> checkUserVerification( + @AuthUser Long userId){ + return GentiResponse.success(userVerificationService.checkUserVerification(userId)); + } + + @PostMapping + public ResponseEntity> savePictureUserVerification( + @AuthUser Long userId, + @RequestBody UserVerificationRequestDto userVerificationRequestDto) { + return GentiResponse.success(userVerificationService.savePictureUserVerification(userId, userVerificationRequestDto)); + } + +} diff --git a/genti-api/src/main/java/com/gt/genti/userverification/dto/request/UserVerificationRequestDto.java b/genti-api/src/main/java/com/gt/genti/userverification/dto/request/UserVerificationRequestDto.java new file mode 100644 index 00000000..7bc76a5d --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/userverification/dto/request/UserVerificationRequestDto.java @@ -0,0 +1,16 @@ +package com.gt.genti.userverification.dto.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +@Schema(name = "[UserVerification][User] 사용자 본인 인증 요청 dto", description = "본인 인증 사진을 저장함") +public class UserVerificationRequestDto { + + @Schema(description = "s3 key", example = "USER_VERIFICATION_IMAGE/image.jpg") + String key; + +} diff --git a/genti-api/src/main/java/com/gt/genti/userverification/service/UserVerificationService.java b/genti-api/src/main/java/com/gt/genti/userverification/service/UserVerificationService.java new file mode 100644 index 00000000..1c67b960 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/userverification/service/UserVerificationService.java @@ -0,0 +1,44 @@ +package com.gt.genti.userverification.service; + +import com.gt.genti.error.ExpectedException; +import com.gt.genti.error.ResponseCode; +import com.gt.genti.picture.userverification.model.PictureUserVerification; +import com.gt.genti.picture.userverification.repository.PictureUserVerificationRepository; +import com.gt.genti.user.model.User; +import com.gt.genti.user.repository.UserRepository; +import com.gt.genti.userverification.dto.request.UserVerificationRequestDto; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Slf4j +@Service +@Transactional +@RequiredArgsConstructor +public class UserVerificationService { + + private final UserRepository userRepository; + private final PictureUserVerificationRepository pictureUserVerificationRepository; + + public Boolean checkUserVerification(Long userId){ + User foundUser = getUserByUserId(userId); + Boolean isVerified = foundUser.getUserVerified(); + return isVerified != null && isVerified; + } + + public Boolean savePictureUserVerification(Long userId, UserVerificationRequestDto userVerificationRequestDto){ + User foundUser = getUserByUserId(userId); + PictureUserVerification pictureUserVerification = new PictureUserVerification(userVerificationRequestDto.getKey(), foundUser); + pictureUserVerificationRepository.save(pictureUserVerification); + foundUser.verifyUser(); + return true; + } + + + private User getUserByUserId(Long userId) { + return userRepository.findById(userId) + .orElseThrow(() -> ExpectedException.withLogging(ResponseCode.UserNotFound, userId)); + } + +} diff --git a/genti-domain/src/main/java/com/gt/genti/picture/userverification/model/PictureUserVerification.java b/genti-domain/src/main/java/com/gt/genti/picture/userverification/model/PictureUserVerification.java new file mode 100644 index 00000000..299b8bd1 --- /dev/null +++ b/genti-domain/src/main/java/com/gt/genti/picture/userverification/model/PictureUserVerification.java @@ -0,0 +1,25 @@ +package com.gt.genti.picture.userverification.model; + +import com.gt.genti.common.picture.model.PictureEntity; +import com.gt.genti.user.model.User; +import jakarta.persistence.*; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Table(name = "picture_user_verification") +@Entity +@Getter +@NoArgsConstructor(access = AccessLevel.PROTECTED) +public class PictureUserVerification extends PictureEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + Long id; + + public PictureUserVerification(String key, User user) { + this.key = key; + this.setUploadedBy(user); + } + +} diff --git a/genti-domain/src/main/java/com/gt/genti/picture/userverification/repository/PictureUserVerificationRepository.java b/genti-domain/src/main/java/com/gt/genti/picture/userverification/repository/PictureUserVerificationRepository.java new file mode 100644 index 00000000..e2672905 --- /dev/null +++ b/genti-domain/src/main/java/com/gt/genti/picture/userverification/repository/PictureUserVerificationRepository.java @@ -0,0 +1,8 @@ +package com.gt.genti.picture.userverification.repository; + +import com.gt.genti.picture.userverification.model.PictureUserVerification; +import org.springframework.data.jpa.repository.JpaRepository; + +public interface PictureUserVerificationRepository extends JpaRepository { + +} \ No newline at end of file diff --git a/genti-domain/src/main/java/com/gt/genti/user/model/User.java b/genti-domain/src/main/java/com/gt/genti/user/model/User.java index 95ac7db4..9b0660d3 100644 --- a/genti-domain/src/main/java/com/gt/genti/user/model/User.java +++ b/genti-domain/src/main/java/com/gt/genti/user/model/User.java @@ -135,6 +135,9 @@ public class User extends BaseTimeEntity { @Column(name = "apple_refresh_token", length = 1024) String appleRefreshToken; + @Column(name = "user_verified") + Boolean userVerified; + @PrePersist public void prePersist() { if (this.userStatus == null) { @@ -276,4 +279,6 @@ public boolean isFirstJoinUser(){ return this.userRole.equals(UserRole.OAUTH_FIRST_JOIN); } + public void verifyUser(){ this.userVerified = true; } + } From cd4c184cd58712e3ddbf7248645de52806432079 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Fri, 27 Sep 2024 17:59:18 +0900 Subject: [PATCH 5/9] =?UTF-8?q?Feat:=20#169=20=EC=A0=90=EA=B2=80=20?= =?UTF-8?q?=EC=97=AC=EB=B6=80=20=ED=99=95=EC=9D=B8=20api(for=20user)=20?= =?UTF-8?q?=EB=B0=8F=20=EC=A0=90=EA=B2=80=20=EC=8B=9C=EC=A7=81=EC=A2=85?= =?UTF-8?q?=EB=A3=8C=20api(for=20admin)=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/api/AdminMaintenanceApi.java | 26 +++++++++++ .../maintenance/api/UserMaintenanceApi.java | 17 +++++++ .../AdminMaintenanceController.java | 45 +++++++++++++++++++ .../controller/UserMaintenanceController.java | 25 +++++++++++ .../response/MaintenanceInfoResponseDto.java | 21 +++++++++ .../service/MaintenanceService.java | 40 +++++++++++++++++ .../genti/constants/WhiteListConstants.java | 2 + 7 files changed, 176 insertions(+) create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/api/AdminMaintenanceApi.java create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/api/UserMaintenanceApi.java create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/controller/AdminMaintenanceController.java create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/controller/UserMaintenanceController.java create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/dto/response/MaintenanceInfoResponseDto.java create mode 100644 genti-api/src/main/java/com/gt/genti/maintenance/service/MaintenanceService.java diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/api/AdminMaintenanceApi.java b/genti-api/src/main/java/com/gt/genti/maintenance/api/AdminMaintenanceApi.java new file mode 100644 index 00000000..a8b5915d --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/api/AdminMaintenanceApi.java @@ -0,0 +1,26 @@ +package com.gt.genti.maintenance.api; + +import com.gt.genti.response.GentiResponse; +import com.gt.genti.swagger.AuthorizedAdmin; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; + +@AuthorizedAdmin +@Tag(name = "[AdminMaintenanceController] 점검 설정", description = "점검 시작 및 점검 종료하기") +public interface AdminMaintenanceApi { + + @Operation(summary = "점검 시작 메시지 설정", description = "점검 시작 메시지를 설정합니다(해당 api 호출 즉시 점검이 시작됩니다") + ResponseEntity> setMaintenanceMessage( + @RequestHeader(value = "Admin-Secret-Key") String secretKey, + @RequestBody String type + ); + + @Operation(summary = "점검 종료", description = "점검을 종료합니다") + ResponseEntity> finishMaintenance( + @RequestHeader(value = "Admin-Secret-Key") String secretKey + ); + +} diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/api/UserMaintenanceApi.java b/genti-api/src/main/java/com/gt/genti/maintenance/api/UserMaintenanceApi.java new file mode 100644 index 00000000..e525633f --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/api/UserMaintenanceApi.java @@ -0,0 +1,17 @@ +package com.gt.genti.maintenance.api; + +import com.gt.genti.maintenance.dto.response.MaintenanceInfoResponseDto; +import com.gt.genti.response.GentiResponse; +import com.gt.genti.swagger.AuthorizedUser; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.http.ResponseEntity; + +@AuthorizedUser +@Tag(name = "[UserMaintenanceController] 점검 정보 확인", description = "서비스 이용 가능 여부 및 점검 메시지 확인") +public interface UserMaintenanceApi { + + @Operation(summary = "점검 정보 확인", description = "서비스 이용 가능 여부 및 점검 메시지를 조회합니다.") + ResponseEntity> getMaintenanceInfo(); + +} diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/controller/AdminMaintenanceController.java b/genti-api/src/main/java/com/gt/genti/maintenance/controller/AdminMaintenanceController.java new file mode 100644 index 00000000..34a50782 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/controller/AdminMaintenanceController.java @@ -0,0 +1,45 @@ +package com.gt.genti.maintenance.controller; + +import com.gt.genti.error.ExpectedException; +import com.gt.genti.error.ResponseCode; +import com.gt.genti.maintenance.api.AdminMaintenanceApi; +import com.gt.genti.maintenance.service.MaintenanceService; +import com.gt.genti.response.GentiResponse; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api/v1/maintenance/setting") +@RequiredArgsConstructor +public class AdminMaintenanceController implements AdminMaintenanceApi { + + private final MaintenanceService maintenanceService; + + @Value("${openchat.admin-secret-key}") + private String ADMIN_SECRET_KEY; + + @PostMapping + public ResponseEntity> setMaintenanceMessage( + @RequestHeader(value = "Admin-Secret-Key") String adminSecretKey, + @RequestBody String message + ){ + if (!ADMIN_SECRET_KEY.equals(adminSecretKey)) { + throw ExpectedException.withLogging(ResponseCode.InvalidOpenChatSecretKey); + } else{ + return GentiResponse.success(maintenanceService.setMaintenanceMessage(message)); + } + } + + @DeleteMapping + public ResponseEntity> finishMaintenance( + @RequestHeader(value = "Admin-Secret-Key") String adminSecretKey + ){ + if (!ADMIN_SECRET_KEY.equals(adminSecretKey)) { + throw ExpectedException.withLogging(ResponseCode.InvalidOpenChatSecretKey); + } else{ + return GentiResponse.success(maintenanceService.finishMaintenance()); + } + } +} diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/controller/UserMaintenanceController.java b/genti-api/src/main/java/com/gt/genti/maintenance/controller/UserMaintenanceController.java new file mode 100644 index 00000000..f796126e --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/controller/UserMaintenanceController.java @@ -0,0 +1,25 @@ +package com.gt.genti.maintenance.controller; + +import com.gt.genti.maintenance.api.UserMaintenanceApi; +import com.gt.genti.maintenance.dto.response.MaintenanceInfoResponseDto; +import com.gt.genti.maintenance.service.MaintenanceService; +import com.gt.genti.response.GentiResponse; +import com.gt.genti.response.GentiResponse.ApiResult; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/v1/maintenance") +@RequiredArgsConstructor +public class UserMaintenanceController implements UserMaintenanceApi { + + private final MaintenanceService maintenanceService; + + @GetMapping + public ResponseEntity> getMaintenanceInfo() { + return GentiResponse.success(maintenanceService.getMaintenanceInfo()); + } +} diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/dto/response/MaintenanceInfoResponseDto.java b/genti-api/src/main/java/com/gt/genti/maintenance/dto/response/MaintenanceInfoResponseDto.java new file mode 100644 index 00000000..0baa8c09 --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/dto/response/MaintenanceInfoResponseDto.java @@ -0,0 +1,21 @@ +package com.gt.genti.maintenance.dto.response; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Getter; + +@Schema(name = "[Maintenance][User] 점검 정보 응답 dto") +@Getter +public class MaintenanceInfoResponseDto { + + @Schema(description = "서비스 이용 가능 여부", example = "false") + Boolean status; + + @Schema(description = "점검 메시지", example = "09:00 ~ 18:00") + String message; + + public MaintenanceInfoResponseDto(Boolean status, String message) { + this.status = status; + this.message = message; + } + +} diff --git a/genti-api/src/main/java/com/gt/genti/maintenance/service/MaintenanceService.java b/genti-api/src/main/java/com/gt/genti/maintenance/service/MaintenanceService.java new file mode 100644 index 00000000..21c087cd --- /dev/null +++ b/genti-api/src/main/java/com/gt/genti/maintenance/service/MaintenanceService.java @@ -0,0 +1,40 @@ +package com.gt.genti.maintenance.service; + +import com.gt.genti.maintenance.dto.response.MaintenanceInfoResponseDto; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@Transactional +@RequiredArgsConstructor +@Slf4j +public class MaintenanceService { + + private final RedisTemplate redisTemplate; + + @Value("{maintenance.redis-key}") + private String maintenanceKey; + + public MaintenanceInfoResponseDto getMaintenanceInfo() { + String maintenanceInfo = redisTemplate.opsForValue().get(maintenanceKey); + if (maintenanceInfo == null) { + return new MaintenanceInfoResponseDto(true, null); + } else { + return new MaintenanceInfoResponseDto(false, maintenanceInfo); + } + } + + public Boolean setMaintenanceMessage(String message){ + redisTemplate.opsForValue().set(maintenanceKey, message); + return true; + } + + public Boolean finishMaintenance(){ + return redisTemplate.delete(maintenanceKey); + } + +} diff --git a/genti-common/src/main/java/com/gt/genti/constants/WhiteListConstants.java b/genti-common/src/main/java/com/gt/genti/constants/WhiteListConstants.java index 84b45c98..8949b8be 100644 --- a/genti-common/src/main/java/com/gt/genti/constants/WhiteListConstants.java +++ b/genti-common/src/main/java/com/gt/genti/constants/WhiteListConstants.java @@ -42,6 +42,7 @@ void postConstruct() { "/h2-console/**", "/h2-console", "/api/v1/open-chat/*", + "/api/v1/maintenance/setting", "/api/v1/push", "/api/v1/push/**" )); @@ -61,6 +62,7 @@ void postConstruct() { "/h2-console/**", "/h2-console", "/api/v1/open-chat/*", + "/api/v1/maintenance/setting", "/api/v1/push", "/api/v1/push/**" )); From 358d70974b0b9bc84f905d1254de9ce99a9be253 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <122717063+LeeJae-H@users.noreply.github.com> Date: Fri, 27 Sep 2024 18:03:36 +0900 Subject: [PATCH 6/9] Delete genti-api/src/main/resources/file-appender.xml --- genti-api/src/main/resources/file-appender.xml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 genti-api/src/main/resources/file-appender.xml diff --git a/genti-api/src/main/resources/file-appender.xml b/genti-api/src/main/resources/file-appender.xml deleted file mode 100644 index fec722d3..00000000 --- a/genti-api/src/main/resources/file-appender.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - logs/genti-%d{yyyy-MM-dd}.log - 90 - - - ${FILE_LOG_PATTERN} - utf8 - - \ No newline at end of file From 86cb15c7016d8059c35a7e401b10eeb8a2498eeb Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Fri, 27 Sep 2024 18:11:00 +0900 Subject: [PATCH 7/9] =?UTF-8?q?Fix:=20=EC=82=AD=EC=A0=9C=EB=90=9C=20file-a?= =?UTF-8?q?ppender.xml=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-api/src/main/resources/file-appender.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 genti-api/src/main/resources/file-appender.xml diff --git a/genti-api/src/main/resources/file-appender.xml b/genti-api/src/main/resources/file-appender.xml new file mode 100644 index 00000000..6d2f1f41 --- /dev/null +++ b/genti-api/src/main/resources/file-appender.xml @@ -0,0 +1,10 @@ + + + /logs/genti-%d{yyyy-MM-dd}.log + 90 + + + ${FILE_LOG_PATTERN} + utf8 + + \ No newline at end of file From 2a57367a64ca952256e185a3742b212d01252150 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Sun, 29 Sep 2024 15:55:32 +0900 Subject: [PATCH 8/9] =?UTF-8?q?Fix:=20#166=20=ED=9A=8C=EC=9B=90=ED=83=88?= =?UTF-8?q?=ED=87=B4=20=EC=B0=B8=EC=A1=B0=EB=AC=B4=EA=B2=B0=EC=84=B1=20?= =?UTF-8?q?=EA=B4=80=EB=A0=A8=20=EC=BD=94=EB=93=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- genti-domain/src/main/java/com/gt/genti/user/model/User.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/genti-domain/src/main/java/com/gt/genti/user/model/User.java b/genti-domain/src/main/java/com/gt/genti/user/model/User.java index 9b0660d3..1afd4a84 100644 --- a/genti-domain/src/main/java/com/gt/genti/user/model/User.java +++ b/genti-domain/src/main/java/com/gt/genti/user/model/User.java @@ -21,6 +21,7 @@ import com.gt.genti.picture.pose.model.PicturePose; import com.gt.genti.picture.profile.model.PictureProfile; import com.gt.genti.picture.userface.model.PictureUserFace; +import com.gt.genti.picture.userverification.model.PictureUserVerification; import com.gt.genti.picturegeneraterequest.model.PictureGenerateRequest; import com.gt.genti.user.UserSerializer; @@ -138,6 +139,9 @@ public class User extends BaseTimeEntity { @Column(name = "user_verified") Boolean userVerified; + @OneToMany(mappedBy = "uploadedBy", cascade = CascadeType.ALL, orphanRemoval = true) + List pictureUserVerificationList; + @PrePersist public void prePersist() { if (this.userStatus == null) { From 0a3d60e17ecd2b661ebc7cd226865ab13e40dcc3 Mon Sep 17 00:00:00 2001 From: LeeJaehyung <540900@naver.com> Date: Mon, 30 Sep 2024 17:49:28 +0900 Subject: [PATCH 9/9] =?UTF-8?q?Fix:=20#173=20settlement=20=EC=97=94?= =?UTF-8?q?=ED=84=B0=ED=8B=B0=EC=97=90=EC=84=9C=20cascade=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/gt/genti/settlement/model/Settlement.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java b/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java index 36423e2b..647a7efe 100644 --- a/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java +++ b/genti-domain/src/main/java/com/gt/genti/settlement/model/Settlement.java @@ -4,15 +4,7 @@ import com.gt.genti.common.basetimeentity.model.BaseTimeEntity; import com.gt.genti.picturegenerateresponse.model.PictureGenerateResponse; -import jakarta.persistence.Column; -import jakarta.persistence.Entity; -import jakarta.persistence.GeneratedValue; -import jakarta.persistence.GenerationType; -import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; -import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; +import jakarta.persistence.*; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; @@ -28,7 +20,7 @@ public class Settlement extends BaseTimeEntity { @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; - @OneToOne + @OneToOne(cascade = CascadeType.REMOVE) @JoinColumn(name = "picture_generate_response_id", referencedColumnName = "id", nullable = false) PictureGenerateResponse pictureGenerateResponse;