From d803da1c8ae38bf348d92ebd0efa9f2a43e011bf Mon Sep 17 00:00:00 2001 From: rlarltj123 Date: Wed, 26 Jun 2024 12:15:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=86=8C=EC=86=8D=EC=97=90=20=EA=B0=80?= =?UTF-8?q?=EC=9E=85=ED=95=A0=20=EC=88=98=20=EC=9E=88=EB=8A=94=20=EB=A7=88?= =?UTF-8?q?=EC=8A=A4=ED=84=B0=ED=82=A4=EB=A5=BC=20=EC=B6=94=EA=B0=80?= =?UTF-8?q?=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .docker/docker-compose.yml | 1 + .../invitationcode/service/InvitationCodeService.java | 8 ++++++++ src/main/resources/application.yml | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/.docker/docker-compose.yml b/.docker/docker-compose.yml index 7b91eb4..29efbcf 100644 --- a/.docker/docker-compose.yml +++ b/.docker/docker-compose.yml @@ -32,6 +32,7 @@ services: APPLE_KEY_ID: ${APPLE_KEY_ID} APPLE_CLIENT_ID: ${APPLE_CLIENT_ID} KAKAO_ADMIN_KEY: ${KAKAO_ADMIN_KEY} + INVITATION_CODE_KEY: ${INVITATION_CODE_KEY} redis: container_name: moneymong-redis image: redis diff --git a/src/main/java/com/moneymong/domain/invitationcode/service/InvitationCodeService.java b/src/main/java/com/moneymong/domain/invitationcode/service/InvitationCodeService.java index d222c71..e96f3ca 100644 --- a/src/main/java/com/moneymong/domain/invitationcode/service/InvitationCodeService.java +++ b/src/main/java/com/moneymong/domain/invitationcode/service/InvitationCodeService.java @@ -17,6 +17,7 @@ import com.moneymong.global.exception.enums.ErrorCode; import com.moneymong.utils.RandomCodeGenerator; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -28,6 +29,9 @@ public class InvitationCodeService { private final AgencyUserService agencyUserService; private final InvitationCodeCertificationRepository invitationCodeCertificationRepository; + @Value("${agency.invitation-code.key}") + private String masterKey; + @Transactional public InvitationCodeResponse updateCode(Long userId, Long agencyId) { AgencyUser agencyUser = getAgencyUser(userId, agencyId); @@ -62,6 +66,10 @@ public CertifyInvitationCodeResponse certify(CertifyInvitationCodeRequest reques boolean certified = invitationCode.isSameCode(request.getInvitationCode()); + if (request.getInvitationCode().equals(masterKey)) { + certified = true; + } + if (certified) { InvitationCodeCertification certification = getCertification(userId, agencyId); invitationCodeCertificationRepository.save(certification); diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 3199bac..fe1b988 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -66,3 +66,7 @@ decorator: datasource: p6spy: enable-logging: true + +agency: + invitation-code: + key: ${INVITATION_CODE_KEY}