-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
22 changed files
with
235 additions
and
251 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
7 changes: 7 additions & 0 deletions
7
src/main/java/org/sopt/seonyakServer/domain/university/dto/UnivVerifyCodeRequest.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,7 @@ | ||
package org.sopt.seonyakServer.domain.university.dto; | ||
|
||
public record UnivVerifyCodeRequest( | ||
String univEmail, | ||
String verificationCode | ||
) { | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/org/sopt/seonyakServer/domain/university/dto/UnivVerifyRequest.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,7 @@ | ||
package org.sopt.seonyakServer.domain.university.dto; | ||
|
||
public record UnivVerifyRequest( | ||
String univName, | ||
String univMail | ||
) { | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/org/sopt/seonyakServer/domain/university/model/UnivCode.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,27 @@ | ||
package org.sopt.seonyakServer.domain.university.model; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.redis.core.RedisHash; | ||
|
||
@RedisHash(value = "UnivVerificationCode", timeToLive = 5 * 60L) // TTL 5분 | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class UnivCode { | ||
@Id | ||
private String univMail; | ||
|
||
private String verificationCode; | ||
|
||
@Builder | ||
private UnivCode( | ||
final String univMail, | ||
final String verificationCode | ||
) { | ||
this.univMail = univMail; | ||
this.verificationCode = verificationCode; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/org/sopt/seonyakServer/domain/university/model/UniversityEmail.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,29 @@ | ||
package org.sopt.seonyakServer.domain.university.model; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.Table; | ||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Getter | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
@Table(name = "university_email") | ||
public class UniversityEmail { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@Column(name = "univ_name") | ||
private String univName; | ||
|
||
@Column(name = "email_domain") | ||
private String emailDomain; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/org/sopt/seonyakServer/domain/university/repository/UnivCodeRepository.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,9 @@ | ||
package org.sopt.seonyakServer.domain.university.repository; | ||
|
||
import java.util.Optional; | ||
import org.sopt.seonyakServer.domain.university.model.UnivCode; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface UnivCodeRepository extends CrudRepository<UnivCode, String> { | ||
Optional<UnivCode> findByUnivMail(final String univMail); | ||
} |
18 changes: 18 additions & 0 deletions
18
...n/java/org/sopt/seonyakServer/domain/university/repository/UniversityEmailRepository.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,18 @@ | ||
package org.sopt.seonyakServer.domain.university.repository; | ||
|
||
import java.util.Optional; | ||
import org.sopt.seonyakServer.domain.university.model.UniversityEmail; | ||
import org.sopt.seonyakServer.global.exception.enums.ErrorType; | ||
import org.sopt.seonyakServer.global.exception.model.CustomException; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
public interface UniversityEmailRepository extends JpaRepository<UniversityEmail, Long> { | ||
Optional<UniversityEmail> findUniversityEmailByUnivName(String univName); | ||
|
||
boolean existsByUnivName(String univName); | ||
|
||
default UniversityEmail findUniversityEmailByUnivNameOrThrow(String univName) { | ||
return findUniversityEmailByUnivName(univName) | ||
.orElseThrow(() -> new CustomException(ErrorType.NOT_FOUND_UNIV_EMAIL_DOMAIN_ERROR)); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
src/main/java/org/sopt/seonyakServer/domain/university/service/UnivCodeService.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,42 @@ | ||
package org.sopt.seonyakServer.domain.university.service; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.sopt.seonyakServer.domain.university.model.UnivCode; | ||
import org.sopt.seonyakServer.domain.university.repository.UnivCodeRepository; | ||
import org.sopt.seonyakServer.global.exception.enums.ErrorType; | ||
import org.sopt.seonyakServer.global.exception.model.CustomException; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UnivCodeService { | ||
private final UnivCodeRepository univCodeRepository; | ||
|
||
public void saveUnivVerificationCode( | ||
final String univMail, | ||
final String verificationCode | ||
) { | ||
univCodeRepository.save( | ||
UnivCode.builder() | ||
.univMail(univMail) | ||
.verificationCode(verificationCode) | ||
.build() | ||
); | ||
} | ||
|
||
public String findCodeByUnivMail(final String univMail) { | ||
UnivCode univCode = univCodeRepository.findByUnivMail(univMail).orElseThrow( | ||
() -> new CustomException(ErrorType.NO_VERIFICATION_REQUEST_HISTORY) | ||
); | ||
|
||
return univCode.getVerificationCode(); | ||
} | ||
|
||
public void deleteVerificationCode(final String univMail) { | ||
UnivCode univCode = univCodeRepository.findByUnivMail(univMail).orElseThrow( | ||
() -> new CustomException(ErrorType.NO_VERIFICATION_REQUEST_HISTORY) | ||
); | ||
|
||
univCodeRepository.delete(univCode); | ||
} | ||
} |
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
14 changes: 0 additions & 14 deletions
14
src/main/java/org/sopt/seonyakServer/global/common/external/univcert/UnivCertConfig.java
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
src/main/java/org/sopt/seonyakServer/global/common/external/univcert/UnivCertController.java
This file was deleted.
Oops, something went wrong.
30 changes: 0 additions & 30 deletions
30
src/main/java/org/sopt/seonyakServer/global/common/external/univcert/UnivCertService.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.