-
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.
폼 상태 변경 시 이메일 전송 문제 해결 및 리팩토링 (#322)
- Loading branch information
1 parent
98efa89
commit 335d742
Showing
7 changed files
with
66 additions
and
102 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
8 changes: 2 additions & 6 deletions
8
src/main/java/com/spaceclub/notification/mail/domain/repository/TemplateRepository.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 |
---|---|---|
@@ -1,16 +1,12 @@ | ||
package com.spaceclub.notification.mail.domain.repository; | ||
|
||
import com.spaceclub.notification.mail.domain.Template; | ||
import com.spaceclub.notification.mail.domain.TemplateName; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
|
||
public interface TemplateRepository extends JpaRepository<Template, Long> { | ||
|
||
@Query("select distinct t.template from Template t " + | ||
"join fetch MailHistory m on m.templateId = t.id " + | ||
"where m.templateName = :templateName") | ||
String findTemplateByTemplateName(@Param("templateName") TemplateName templateName); | ||
@Query("select t.template from Template t where t.id = :templateId") | ||
String findHTMLByTemplateId(Long templateId); | ||
|
||
} |
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
33 changes: 33 additions & 0 deletions
33
src/test/java/com/spaceclub/notification/mail/domain/TemplateNameTest.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,33 @@ | ||
package com.spaceclub.notification.mail.domain; | ||
|
||
import com.spaceclub.SpaceClubCustomDisplayNameGenerator; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@DisplayNameGeneration(SpaceClubCustomDisplayNameGenerator.class) | ||
class TemplateNameTest { | ||
|
||
@ParameterizedTest | ||
@CsvSource({"welcome, WELCOME", "event-status-change, EVENT_STATUS_CHANGED"}) | ||
void 템플릿_이름으로_템플릿_이름_조회에_성공한다(String templateName, TemplateName expected) { | ||
// when | ||
TemplateName result = TemplateName.findByTemplateName(templateName); | ||
|
||
// then | ||
assertThat(result).isEqualTo(expected); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({"welcome, 1", "event-status-change, 2"}) | ||
void 템플릿_이름으로_템플릿_ID_조회에_성공한다(String templateName, Long expectedId) { | ||
// when | ||
Long result = TemplateName.findTemplateIdByTemplateName(templateName); | ||
|
||
// then | ||
assertThat(result).isEqualTo(expectedId); | ||
} | ||
|
||
} |
84 changes: 0 additions & 84 deletions
84
src/test/java/com/spaceclub/notification/mail/repository/TemplateNameRepositoryTest.java
This file was deleted.
Oops, something went wrong.