Skip to content

Commit

Permalink
[CHORE] QA 내용 반영 (#309)
Browse files Browse the repository at this point in the history
* [CHORE] 대학, 학과 길이 제한 변경

* [CHORE] 대학 도메인 길이 변경

* [FIX] 이미 존재하는 이메일인지 검증 로직 추가

* [CHORE] 로깅 출력 방식 변경

* [CHORE] 제약조건 추가

* [CHORE] 최대 길이 수정
  • Loading branch information
mikekks authored May 2, 2024
1 parent 9fd3c8a commit b0e0f68
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum AuthExceptionType implements ExceptionType {
INVALID_REFRESH_TOKEN(HttpStatus.BAD_REQUEST, "유효하지 않은 리프레시 토큰입니다."),
INVALID_MAIL_SERVICE(HttpStatus.BAD_REQUEST, "메일 서비스를 이용할 수 없는 형식입니다."),
INVALID_ACCESS(HttpStatus.BAD_REQUEST, "올바르지 않는 요청입니다."),
ALREADY_REGISTER(HttpStatus.BAD_REQUEST, "이미 가입된 이메일입니다."),
INVALID_VERIFY_MAIL(HttpStatus.BAD_REQUEST, "잘못된 이메일 코드 입니다."),
INVALID_MAIL_REGEX(HttpStatus.BAD_REQUEST, "학교 도메인과 유저의 도메인이 다릅니다."),

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package synk.meeteam.domain.auth.service;

import static synk.meeteam.domain.auth.exception.AuthExceptionType.ALREADY_REGISTER;
import static synk.meeteam.domain.auth.exception.AuthExceptionType.INVALID_ACCESS;

import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -67,6 +68,11 @@ protected User saveTempUser(AuthUserRequestDto request, String email, String nam

@Transactional
public void updateUniversityInfo(VerifyEmailRequestDto requestDTO, String email) {
User foundUser = userRepository.findByUniversityEmail(email).orElse(null);
if(foundUser != null){
throw new AuthException(ALREADY_REGISTER);
}

UserVO userVO = redisUserRepository.findByPlatformIdOrElseThrowException(requestDTO.platformId());
userVO.updateUniversityInfo(requestDTO.universityId(), requestDTO.departmentId(), requestDTO.year(),
email);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ public class Department {
private University university;

@NotNull
@Column(length = 20)
@Column(length = 70)
private String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public class University {
private Long id;

@NotNull
@Column(length = 20)
@Column(length = 70)
private String name;

@NotNull
@Column(length = 20)
@Column(length = 30)
private String emailRegex;

public University(String name, String emailRegex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;

public record CourseTagDto(
@NotNull
@Schema(description = "수업 여부", example = "true")
Boolean isCourse,
@Schema(description = "수업 관련 태그 이름", example = "응용소프트웨어실습 or null")
@Size(max = 20)
String courseTagName,
@Schema(description = "교수명", example = "김용혁 or null")
@Size(max = 20)
String courseProfessor
) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public record CreateRecruitmentPostRequestDto(
CourseTagDto courseTag,
@NotNull
@Schema(description = "태그", example = "[\"웹개발\", \"AI\", \"졸업작품\"]")
@Size(max = 5)
List<String> tags,
@NotNull
@Schema(description = "필요한 역할들(List 형태로)", example = "")
@Size(max = 10)
List<RecruitmentRoleDto> recruitmentRoles,
@NotBlank
@Size(min = 5, max = 40)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ default User findByPlatformIdAndPlatformTypeOrElseThrowException(String platform
() -> new AuthException(NOT_FOUND_USER));
}

Optional<User> findByUniversityEmail(String email);

}
10 changes: 7 additions & 3 deletions src/main/java/synk/meeteam/global/aop/ExecutionLoggingAop.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,17 @@ public Object logExecutionTrace(ProceedingJoinPoint pjp) throws Throwable {
log.info("[Call Method] " + httpMethod.toString() + ": " + task + " | Request userId=" + userId.toString());

Object[] paramArgs = pjp.getArgs();
String loggingMessage = "";
int cnt = 1;
for (Object object : paramArgs) {
if (Objects.nonNull(object)) {
log.info("[parameter type] {}", object.getClass().getSimpleName());
log.info("[parameter value] {}", object);
String paramName = "[param" + cnt +"] " + object.getClass().getSimpleName();
String paramValue = " [value" + cnt +"] " + object;
loggingMessage += paramName + paramValue + "\n";
cnt++;
}
}

log.info("{}", loggingMessage);
// 해당 클래스 처리 전의 시간
StopWatch sw = new StopWatch();
sw.start();
Expand Down

0 comments on commit b0e0f68

Please sign in to comment.