-
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.
GETP-157 feat: 프로젝트 지원자 미팅 신청 구현 (#107)
* GETP-157 feat : 미팅 신청 기능 구현 * GETP-153 test : 미팅 신청 기능 테스트 작성 * GETP-157 chore: 도메인 레이어에 서비스 명시를 위한 도메인 서비스 어노테이션 생성 및 API명 수정 * GETP-157 refactor: 미팅 신청에 대한 비즈니스 로직을 도메인 계층과 어플리케이션 계층으로 분리 * GETP-157 test: DDD를 적용한 미팅 신청 기능 컨트롤러 테스트 작성 * GETP-157 refactor: `SimpleMailMessage` 객체 생성에 대한 책임을 `MailSender`로 이동 및 추상화 수준에 맞는 예외를 던지도록 변경 * GETP-157 feat: 미팅 신청 시 미팅 일정을 한 번만 등록할 수 있도록 변경 * GETP-157 docs: 프로젝트 미팅 신청 API 문서 작성 * GETP-157 test: 프로젝트 미팅 신청 도메인 서비스 테스트 작성 * GETP-157 fix: PhoneNumberMapper의 NPE 오류 수정 --------- Co-authored-by: wlgns12370 <[email protected]>
- Loading branch information
1 parent
f15325a
commit 45b6ca6
Showing
63 changed files
with
978 additions
and
165 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,4 +105,7 @@ local.sh | |
|
||
# Static Resources | ||
src/main/resources/static/* | ||
storage/ | ||
storage/ | ||
|
||
# Yml File | ||
local-docker-compose.yml |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
operation::/schedule-meeting/schedule-meeting[snippets="http-request,request-headers,request-fields,http-response,response-fields-data"] |
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
2 changes: 0 additions & 2 deletions
2
src/main/java/es/princip/getp/domain/auth/application/AccessTokenService.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
37 changes: 0 additions & 37 deletions
37
src/main/java/es/princip/getp/domain/auth/application/EmailServiceImpl.java
This file was deleted.
Oops, something went wrong.
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
25 changes: 0 additions & 25 deletions
25
src/main/java/es/princip/getp/domain/auth/exception/EmailErrorCode.java
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
...in/java/es/princip/getp/domain/auth/exception/FailedVerificationCodeSendingException.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,14 @@ | ||
package es.princip.getp.domain.auth.exception; | ||
|
||
import es.princip.getp.infra.exception.ErrorDescription; | ||
import es.princip.getp.infra.exception.ExternalApiErrorException; | ||
|
||
public class FailedVerificationCodeSendingException extends ExternalApiErrorException { | ||
|
||
private static final String code = "FAILED_VERIFICATION_CODE_SENDING"; | ||
private static final String message = "인증 코드 전송에 실패했습니다. 잠시 후 다시 시도해주세요."; | ||
|
||
public FailedVerificationCodeSendingException() { | ||
super(ErrorDescription.of(code, message)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/es/princip/getp/domain/auth/infra/MailVerificationCodeSender.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,46 @@ | ||
package es.princip.getp.domain.auth.infra; | ||
|
||
import es.princip.getp.domain.auth.application.VerificationCodeSender; | ||
import es.princip.getp.domain.auth.exception.FailedVerificationCodeSendingException; | ||
import es.princip.getp.domain.member.command.domain.model.Email; | ||
import es.princip.getp.infra.mail.MailSender; | ||
import es.princip.getp.infra.mail.command.SendMailCommand; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.mail.MailException; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class MailVerificationCodeSender implements VerificationCodeSender { | ||
|
||
private final MailSender mailSender; | ||
|
||
private static String title() { | ||
return "[GET-P] 회원가입 인증 코드"; | ||
} | ||
|
||
private static String text(final String verificationCode) { | ||
return String.format( | ||
""" | ||
안녕하십니까 GET-P입니다. | ||
인증 코드 번호는 %s 입니다. | ||
감사합니다. | ||
""", | ||
verificationCode | ||
); | ||
} | ||
|
||
@Override | ||
public void send(final Email email, final String verificationCode) { | ||
final SendMailCommand command = SendMailCommand.of( | ||
email, | ||
title(), | ||
text(verificationCode) | ||
); | ||
try { | ||
mailSender.send(command); | ||
} catch (MailException exception) { | ||
throw new FailedVerificationCodeSendingException(); | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/es/princip/getp/domain/common/annotation/DomainService.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 es.princip.getp.domain.common.annotation; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public @interface DomainService { | ||
|
||
} |
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
73 changes: 73 additions & 0 deletions
73
src/main/java/es/princip/getp/domain/common/domain/MeetingSchedule.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,73 @@ | ||
package es.princip.getp.domain.common.domain; | ||
|
||
import es.princip.getp.domain.common.exception.StartTimeIsAfterEndTimeException; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embeddable; | ||
import jakarta.persistence.MappedSuperclass; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AccessLevel; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDate; | ||
import java.time.LocalTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
@Getter | ||
@Embeddable | ||
@MappedSuperclass | ||
@EqualsAndHashCode | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class MeetingSchedule { | ||
|
||
@Column(name = "date") | ||
@NotNull | ||
private LocalDate date; | ||
|
||
@Column(name = "start_time") | ||
@NotNull | ||
private LocalTime startTime; | ||
|
||
@Column(name = "end_time") | ||
@NotNull | ||
private LocalTime endTime; | ||
|
||
public MeetingSchedule( | ||
final LocalDate date, | ||
final LocalTime startTime, | ||
final LocalTime endTime | ||
) { | ||
validate(startTime, endTime); | ||
this.date = date; | ||
this.startTime = startTime; | ||
this.endTime = endTime; | ||
} | ||
|
||
public static MeetingSchedule of( | ||
final LocalDate date, | ||
final LocalTime startTime, | ||
final LocalTime endTime | ||
) { | ||
return new MeetingSchedule(date, startTime, endTime); | ||
} | ||
|
||
private void validate(final LocalTime startTime, final LocalTime endTime) { | ||
if (startTime.isAfter(endTime)) { | ||
throw new StartTimeIsAfterEndTimeException(); | ||
} | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy년 MM월 dd일"); | ||
final DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern("HH:mm"); | ||
|
||
return String.format( | ||
"%s %s ~ %s", | ||
date.format(dateFormatter), | ||
startTime.format(timeFormatter), | ||
endTime.format(timeFormatter) | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/es/princip/getp/domain/common/exception/StartTimeIsAfterEndTimeException.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,11 @@ | ||
package es.princip.getp.domain.common.exception; | ||
|
||
import es.princip.getp.infra.exception.BusinessLogicException; | ||
|
||
public class StartTimeIsAfterEndTimeException extends BusinessLogicException{ | ||
|
||
public StartTimeIsAfterEndTimeException() { | ||
super("시작 시간이 종료 시간보다 늦을 수 없습니다."); | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/es/princip/getp/domain/common/infra/PhoneNumberMapper.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,10 @@ | ||
package es.princip.getp.domain.common.infra; | ||
|
||
import es.princip.getp.domain.member.command.domain.model.PhoneNumber; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper(componentModel = "spring") | ||
public interface PhoneNumberMapper { | ||
|
||
PhoneNumber mapToPhoneNumber(String value); | ||
} |
Oops, something went wrong.