-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Refactor#209 인증 도메인 구조 변경
- Loading branch information
Showing
62 changed files
with
949 additions
and
531 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
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
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
8 changes: 8 additions & 0 deletions
8
...in/java/coffeemeet/server/certification/domain/repository/VerificationInfoRepository.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,8 @@ | ||
package coffeemeet.server.certification.domain.repository; | ||
|
||
import coffeemeet.server.certification.domain.VerificationInfo; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface VerificationInfoRepository extends CrudRepository<VerificationInfo, Long> { | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
src/main/java/coffeemeet/server/certification/implement/BusinessCardImageDeleter.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,22 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import static coffeemeet.server.common.domain.S3KeyPrefix.BUSINESS_CARD; | ||
|
||
import coffeemeet.server.certification.domain.Certification; | ||
import coffeemeet.server.common.implement.ImageDeleter; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class BusinessCardImageDeleter { | ||
|
||
private final CertificationQuery certificationQuery; | ||
private final ImageDeleter imageDeleter; | ||
|
||
public void deleteBusinessCardImageByUserId(Long userId) { | ||
Certification certification = certificationQuery.getCertificationByUserId(userId); | ||
imageDeleter.deleteImage(certification.getBusinessCardUrl(), BUSINESS_CARD); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/coffeemeet/server/certification/implement/BusinessCardImageUploader.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,20 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import static coffeemeet.server.common.domain.S3KeyPrefix.BUSINESS_CARD; | ||
|
||
import coffeemeet.server.common.implement.ImageUploader; | ||
import java.io.File; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class BusinessCardImageUploader { | ||
|
||
private final ImageUploader imageUploader; | ||
|
||
public String uploadBusinessCardImage(File businessCardImage) { | ||
return imageUploader.uploadImage(businessCardImage, BUSINESS_CARD); | ||
} | ||
|
||
} |
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
25 changes: 25 additions & 0 deletions
25
src/main/java/coffeemeet/server/certification/implement/CompanyEmailValidator.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,25 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import static coffeemeet.server.certification.exception.CertificationErrorCode.EXISTED_COMPANY_EMAIL; | ||
|
||
import coffeemeet.server.certification.domain.CompanyEmail; | ||
import coffeemeet.server.common.execption.InvalidInputException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class CompanyEmailValidator { | ||
|
||
private static final String EXISTED_COMPANY_EMAIL_MESSAGE = "이미 사용 중인 회사 이메일(%s) 입니다."; | ||
|
||
private final CertificationQuery certificationQuery; | ||
|
||
public void validateDuplicatedCompanyEmail(CompanyEmail companyEmail) { | ||
if (certificationQuery.isExistedCompanyEmail(companyEmail)) { | ||
throw new InvalidInputException(EXISTED_COMPANY_EMAIL, | ||
String.format(EXISTED_COMPANY_EMAIL_MESSAGE, companyEmail.getValue())); | ||
} | ||
} | ||
|
||
} |
20 changes: 0 additions & 20 deletions
20
src/main/java/coffeemeet/server/certification/implement/EmailVerificationCommand.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/java/coffeemeet/server/certification/implement/VerificationCodeGenerator.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,15 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import java.util.random.RandomGenerator; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class VerificationCodeGenerator { | ||
|
||
private static final RandomGenerator RANDOM_GENERATOR = RandomGenerator.getDefault(); | ||
|
||
public String generateVerificationCode() { | ||
return String.format("%06d", RANDOM_GENERATOR.nextInt(1000000)); | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/coffeemeet/server/certification/implement/VerificationCodeValidator.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,20 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import static coffeemeet.server.certification.exception.CertificationErrorCode.INVALID_VERIFICATION_CODE; | ||
|
||
import coffeemeet.server.common.execption.InvalidInputException; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class VerificationCodeValidator { | ||
|
||
private static final String WRONG_VERIFICATION_CODE_MESSAGE = "잘못된 인증코드(%s)를 입력했습니다."; | ||
|
||
public void validateVerificationCode(String verificationCode, String userInputCode) { | ||
if (!userInputCode.equals(verificationCode)) { | ||
throw new InvalidInputException(INVALID_VERIFICATION_CODE, | ||
String.format(WRONG_VERIFICATION_CODE_MESSAGE, verificationCode)); | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/coffeemeet/server/certification/implement/VerificationInfoCommand.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,20 @@ | ||
package coffeemeet.server.certification.implement; | ||
|
||
import coffeemeet.server.certification.domain.CompanyEmail; | ||
import coffeemeet.server.certification.domain.VerificationInfo; | ||
import coffeemeet.server.certification.domain.repository.VerificationInfoRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class VerificationInfoCommand { | ||
|
||
private final VerificationInfoRepository verificationInfoRepository; | ||
|
||
public void createVerificationInfo(Long userId, CompanyEmail companyEmail, | ||
String verificationCode) { | ||
verificationInfoRepository.save(new VerificationInfo(userId, companyEmail, verificationCode)); | ||
} | ||
|
||
} |
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
Oops, something went wrong.