Skip to content

Commit

Permalink
feat: 소속에 가입할 수 있는 마스터키를 추가한다.
Browse files Browse the repository at this point in the history
  • Loading branch information
rlarltj committed Jun 26, 2024
1 parent bde00a2 commit d803da1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,7 @@ decorator:
datasource:
p6spy:
enable-logging: true

agency:
invitation-code:
key: ${INVITATION_CODE_KEY}

0 comments on commit d803da1

Please sign in to comment.