diff --git a/likelion-client/src/main/java/likelion/univ/alarm/dto/request/AlarmRegisterRequestDto.java b/likelion-client/src/main/java/likelion/univ/alarm/dto/request/AlarmRegisterRequestDto.java index d7454965..53012e79 100644 --- a/likelion-client/src/main/java/likelion/univ/alarm/dto/request/AlarmRegisterRequestDto.java +++ b/likelion-client/src/main/java/likelion/univ/alarm/dto/request/AlarmRegisterRequestDto.java @@ -2,8 +2,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import likelion.univ.domain.alarm.entity.Alarm; -import likelion.univ.domain.alarm.entity.AlarmType; -import likelion.univ.domain.alarm.entity.SendStatus; import lombok.Getter; import lombok.NoArgsConstructor; import org.jetbrains.annotations.NotNull; @@ -17,15 +15,10 @@ public class AlarmRegisterRequestDto { @Schema(description = "이메일", example = "tmfrk0426@gmail.com", required = true) private String email; - @NotNull - @Schema(description = "알람 타입", example = "NEW_UNIVERSITY_RECRUITING", required = true, enumAsRef = true) - private AlarmType alarmType; - public static Alarm toEntity(Long ordinal, AlarmRegisterRequestDto alarmRegisterRequestDto){ return Alarm.builder() .ordinal(ordinal) .email(alarmRegisterRequestDto.getEmail()) - .alarmType(alarmRegisterRequestDto.getAlarmType()) .sendStatus(NOT_SENT) .build(); } diff --git a/likelion-client/src/main/java/likelion/univ/alarm/usecase/RegisterAlarmUseCase.java b/likelion-client/src/main/java/likelion/univ/alarm/usecase/RegisterAlarmUseCase.java index 0c7e9e7c..fbbd4b69 100644 --- a/likelion-client/src/main/java/likelion/univ/alarm/usecase/RegisterAlarmUseCase.java +++ b/likelion-client/src/main/java/likelion/univ/alarm/usecase/RegisterAlarmUseCase.java @@ -14,8 +14,7 @@ public class RegisterAlarmUseCase { private final AlarmDomainService alarmDomainService; public void execute(Long ordinal, AlarmRegisterRequestDto alarmRegisterRequestDto){ - alarmAdaptor.existsByOrdinalAndEmailAndAlarmType(ordinal, - alarmRegisterRequestDto.getEmail(), alarmRegisterRequestDto.getAlarmType()); + alarmAdaptor.existsByOrdinalAndEmailAndAlarmType(ordinal, alarmRegisterRequestDto.getEmail()); Alarm newAlarm = AlarmRegisterRequestDto.toEntity(ordinal, alarmRegisterRequestDto); alarmDomainService.createAlarm(newAlarm); } diff --git a/likelion-core/src/main/java/likelion/univ/domain/alarm/adaptor/AlarmAdaptor.java b/likelion-core/src/main/java/likelion/univ/domain/alarm/adaptor/AlarmAdaptor.java index 8e76a1a1..ad04eea7 100644 --- a/likelion-core/src/main/java/likelion/univ/domain/alarm/adaptor/AlarmAdaptor.java +++ b/likelion-core/src/main/java/likelion/univ/domain/alarm/adaptor/AlarmAdaptor.java @@ -2,7 +2,6 @@ import likelion.univ.annotation.Adaptor; import likelion.univ.domain.alarm.entity.Alarm; -import likelion.univ.domain.alarm.entity.AlarmType; import likelion.univ.domain.alarm.exception.EmailAlreadyRegisteredAsAlarmException; import likelion.univ.domain.alarm.repository.AlarmRepository; import lombok.RequiredArgsConstructor; @@ -14,8 +13,8 @@ public class AlarmAdaptor { public Alarm save(Alarm alarm){ return alarmRepository.save(alarm);} - public void existsByOrdinalAndEmailAndAlarmType(Long ordinal, String email, AlarmType alarmType) { - if (alarmRepository.existsByOrdinalAndEmailAndAlarmType(ordinal, email, alarmType)) + public void existsByOrdinalAndEmailAndAlarmType(Long ordinal, String email) { + if (alarmRepository.existsByOrdinalAndEmail(ordinal, email)) throw new EmailAlreadyRegisteredAsAlarmException(); } } diff --git a/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/Alarm.java b/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/Alarm.java index 4ba12003..6616d806 100644 --- a/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/Alarm.java +++ b/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/Alarm.java @@ -20,9 +20,6 @@ public class Alarm extends BaseTimeEntity { private String email; - @Enumerated(EnumType.STRING) - private AlarmType alarmType; - @Enumerated(EnumType.STRING) private SendStatus sendStatus; } diff --git a/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/AlarmType.java b/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/AlarmType.java deleted file mode 100644 index 4602f7f4..00000000 --- a/likelion-core/src/main/java/likelion/univ/domain/alarm/entity/AlarmType.java +++ /dev/null @@ -1,13 +0,0 @@ -package likelion.univ.domain.alarm.entity; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public enum AlarmType { - NEW_UNIVERSITY_RECRUITING("신규 대학 모집 알람"), - EXISTING_UNIVERSITY_RECRUITING("기존 대학 재신청 알람"); - - private String value; -} diff --git a/likelion-core/src/main/java/likelion/univ/domain/alarm/repository/AlarmRepository.java b/likelion-core/src/main/java/likelion/univ/domain/alarm/repository/AlarmRepository.java index 12ae20bf..1584eee8 100644 --- a/likelion-core/src/main/java/likelion/univ/domain/alarm/repository/AlarmRepository.java +++ b/likelion-core/src/main/java/likelion/univ/domain/alarm/repository/AlarmRepository.java @@ -1,9 +1,8 @@ package likelion.univ.domain.alarm.repository; import likelion.univ.domain.alarm.entity.Alarm; -import likelion.univ.domain.alarm.entity.AlarmType; import org.springframework.data.jpa.repository.JpaRepository; public interface AlarmRepository extends JpaRepository { - boolean existsByOrdinalAndEmailAndAlarmType(Long ordinal, String email, AlarmType alarmType); + boolean existsByOrdinalAndEmail(Long ordinal, String email); } diff --git a/likelion-core/src/main/java/likelion/univ/domain/alarm/service/AlarmDomainService.java b/likelion-core/src/main/java/likelion/univ/domain/alarm/service/AlarmDomainService.java index 63b4a5a5..1ede2628 100644 --- a/likelion-core/src/main/java/likelion/univ/domain/alarm/service/AlarmDomainService.java +++ b/likelion-core/src/main/java/likelion/univ/domain/alarm/service/AlarmDomainService.java @@ -2,14 +2,10 @@ import likelion.univ.domain.alarm.adaptor.AlarmAdaptor; import likelion.univ.domain.alarm.entity.Alarm; -import likelion.univ.domain.alarm.entity.AlarmType; -import likelion.univ.domain.alarm.entity.SendStatus; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import static likelion.univ.domain.alarm.entity.SendStatus.NOT_SENT; - @Service @Transactional(readOnly = true) @RequiredArgsConstructor