-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mail): change to send mail to members only
- Loading branch information
Showing
11 changed files
with
49 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -462,7 +462,7 @@ class DatabaseInitializer( | |
subject = "[우아한테크코스] 프리코스를 진행하는 목적과 사전 준비", | ||
body = "안녕하세요.", | ||
sender = "[email protected]", | ||
recipients = listOf("[email protected]", "[email protected]", "[email protected]", "[email protected]"), | ||
recipients = listOf(1L, 2L, 3L, 4L), | ||
sentTime = createLocalDateTime(2020, 11, 5, 10) | ||
) | ||
) | ||
|
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
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 |
---|---|---|
|
@@ -7,14 +7,14 @@ import java.time.LocalDateTime | |
private const val SUBJECT: String = "메일제목" | ||
private const val BODY: String = "메일 본문 입니다." | ||
private const val SENDER: String = "[email protected]" | ||
private val RECIPIENTS: List<String> = listOf("[email protected]", "[email protected]") | ||
private val RECIPIENTS: List<Long> = listOf(1L, 2L) | ||
private val SENT_TIME: LocalDateTime = LocalDateTime.now() | ||
|
||
fun createMailHistory( | ||
subject: String = SUBJECT, | ||
body: String = BODY, | ||
sender: String = SENDER, | ||
recipients: List<String> = RECIPIENTS, | ||
recipients: List<Long> = RECIPIENTS, | ||
sentTime: LocalDateTime = SENT_TIME, | ||
id: Long = 0L | ||
): MailHistory { | ||
|
@@ -25,7 +25,7 @@ fun createMailData( | |
subject: String = SUBJECT, | ||
body: String = BODY, | ||
sender: String = SENDER, | ||
recipients: List<String> = RECIPIENTS, | ||
recipients: List<Long> = RECIPIENTS, | ||
sentTime: LocalDateTime = SENT_TIME, | ||
id: Long = 0L | ||
): MailData { | ||
|
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 |
---|---|---|
|
@@ -10,7 +10,6 @@ import apply.domain.evaluationtarget.EvaluationStatus.PENDING | |
import apply.domain.evaluationtarget.EvaluationStatus.WAITING | ||
import apply.domain.evaluationtarget.EvaluationTargetRepository | ||
import apply.domain.member.MemberRepository | ||
import apply.domain.member.findAllByEmailIn | ||
import io.kotest.core.spec.style.BehaviorSpec | ||
import io.kotest.matchers.collections.shouldBeEmpty | ||
import io.kotest.matchers.collections.shouldContainExactlyInAnyOrder | ||
|
@@ -69,7 +68,7 @@ class MailTargetServiceTest : BehaviorSpec({ | |
|
||
Then("평가 대상자의 이름 및 이메일을 확인할 수 있다") { | ||
actual shouldHaveSize 1 | ||
actual[0] shouldBe MailTargetResponse(member.email, member.name) | ||
actual[0] shouldBe MailTargetResponse(member) | ||
} | ||
} | ||
} | ||
|
@@ -88,7 +87,7 @@ class MailTargetServiceTest : BehaviorSpec({ | |
|
||
Then("평가 대상자의 이름 및 이메일을 확인할 수 있다") { | ||
actual shouldHaveSize 1 | ||
actual[0] shouldBe MailTargetResponse(member.email, member.name) | ||
actual[0] shouldBe MailTargetResponse(member) | ||
} | ||
} | ||
} | ||
|
@@ -107,7 +106,7 @@ class MailTargetServiceTest : BehaviorSpec({ | |
|
||
Then("평가 대상자의 이름 및 이메일을 확인할 수 있다") { | ||
actual shouldHaveSize 1 | ||
actual[0] shouldBe MailTargetResponse(member.email, member.name) | ||
actual[0] shouldBe MailTargetResponse(member) | ||
} | ||
} | ||
} | ||
|
@@ -141,16 +140,21 @@ class MailTargetServiceTest : BehaviorSpec({ | |
} | ||
} | ||
|
||
Given("특정 이메일을 가진 회원이 없는 경우") { | ||
val email = "[email protected]" | ||
// TODO[#754]: 탈퇴한 회원의 경우 default 정보가 노출된다. | ||
Given("메일 이력을 통해 회원 id 목록을 확인할 수 있는 경우") { | ||
val members = listOf( | ||
createMember(id = 1L), | ||
createMember(id = 2L), | ||
createMember(id = 3L) | ||
) | ||
|
||
every { memberRepository.findAllByEmailIn(any()) } returns emptyList() | ||
every { memberRepository.findAllById(any()) } returns members | ||
|
||
When("해당 이메일로 이메일 정보를 조회하면") { | ||
val actual = mailTargetService.findAllByEmails(listOf(email)) | ||
When("회원 id를 사용해 메일 수신자 정보를 조회하면") { | ||
val actual = mailTargetService.findAllByMemberIds(listOf(1L, 2L, 3L, 4L)) | ||
|
||
Then("이름이 비어있는 것을 확인할 수 있다") { | ||
actual[0] shouldBe MailTargetResponse(email, null) | ||
Then("현재 회원인 메일 수신자만 확인할 수 있다") { | ||
actual shouldHaveSize 3 | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -121,7 +121,7 @@ class EvaluationTargetRestControllerTest : RestControllerTest() { | |
@EnumSource(names = ["PASS", "FAIL", "WAITING"]) | ||
@ParameterizedTest | ||
fun `메일 발송 대상(합격자)들의 이메일 정보를 조회한다`(enumStatus: EvaluationStatus) { | ||
val responses = listOf(MailTargetResponse("[email protected]", "김로키")) | ||
val responses = listOf(MailTargetResponse("[email protected]", "김로키", 1L)) | ||
every { mailTargetService.findMailTargets(any(), any()) } returns responses | ||
|
||
mockMvc.get("/api/recruitments/{recruitmentId}/evaluations/{evaluationId}/targets/emails", 1L, 1L) { | ||
|