-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 합불 결과 조회 기능 구현 #88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/land/leets/domain/application/presentation/dto/ApplicationStatusResponse.kt
This file contains hidden or 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,39 @@ | ||
| package land.leets.domain.application.presentation.dto | ||
|
|
||
| import land.leets.domain.application.domain.Application | ||
| import land.leets.domain.application.type.ApplicationStatus | ||
| import land.leets.domain.interview.domain.Interview | ||
| import land.leets.domain.interview.type.HasInterview | ||
| import java.time.LocalDateTime | ||
|
|
||
| data class ApplicationStatusResponse( | ||
| val id: Long, | ||
| val status: ApplicationStatus, | ||
| val hasInterview: HasInterview?, | ||
| val interviewDate: LocalDateTime?, | ||
| val interviewPlace: String?, | ||
| ) { | ||
| companion object { | ||
| fun of( | ||
| application: Application, | ||
| interview: Interview?, | ||
| ): ApplicationStatusResponse { | ||
| if (application.applicationStatus != ApplicationStatus.PASS_PAPER) { | ||
| return ApplicationStatusResponse( | ||
| id = application.id!!, | ||
| status = application.applicationStatus, | ||
| hasInterview = null, | ||
| interviewDate = null, | ||
| interviewPlace = null, | ||
| ) | ||
| } | ||
| return ApplicationStatusResponse( | ||
| id = application.id!!, | ||
| status = application.applicationStatus, | ||
| hasInterview = interview!!.hasInterview, | ||
| interviewDate = interview.fixedInterviewDate, | ||
| interviewPlace = interview.place, | ||
| ) | ||
| } | ||
| } | ||
| } | ||
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/land/leets/domain/application/usecase/GetApplicationStatus.kt
This file contains hidden or 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 land.leets.domain.application.usecase | ||
|
|
||
| import land.leets.domain.application.presentation.dto.ApplicationStatusResponse | ||
| import java.util.UUID | ||
|
|
||
| interface GetApplicationStatus { | ||
| fun execute(uid: UUID): ApplicationStatusResponse | ||
| } |
24 changes: 24 additions & 0 deletions
24
src/main/kotlin/land/leets/domain/application/usecase/GetApplicationStatusImpl.kt
This file contains hidden or 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,24 @@ | ||
| package land.leets.domain.application.usecase | ||
|
|
||
| import land.leets.domain.application.domain.repository.ApplicationRepository | ||
| import land.leets.domain.application.exception.ApplicationNotFoundException | ||
| import land.leets.domain.application.presentation.dto.ApplicationStatusResponse | ||
| import land.leets.domain.interview.domain.repository.InterviewRepository | ||
| import org.springframework.stereotype.Service | ||
| import org.springframework.transaction.annotation.Transactional | ||
| import java.util.UUID | ||
|
|
||
| @Service | ||
| @Transactional(readOnly = true) | ||
| class GetApplicationStatusImpl( | ||
| private val applicationRepository: ApplicationRepository, | ||
| private val interviewRepository: InterviewRepository, | ||
| ) : GetApplicationStatus { | ||
| override fun execute(uid: UUID): ApplicationStatusResponse { | ||
| val application = applicationRepository.findByUser_Id(uid) | ||
| ?: throw ApplicationNotFoundException() | ||
| val interview = interviewRepository.findByApplication(application) | ||
|
|
||
| return ApplicationStatusResponse.of(application, interview) | ||
| } | ||
| } |
97 changes: 97 additions & 0 deletions
97
src/test/kotlin/land/leets/domain/application/usecase/GetApplicationStatusImplTest.kt
This file contains hidden or 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,97 @@ | ||
| package land.leets.domain.application.usecase | ||
|
|
||
| import io.kotest.assertions.throwables.shouldThrow | ||
| import io.kotest.core.spec.style.DescribeSpec | ||
| import io.kotest.matchers.shouldBe | ||
| import io.mockk.every | ||
| import io.mockk.mockk | ||
| import land.leets.domain.application.domain.Application | ||
| import land.leets.domain.application.domain.repository.ApplicationRepository | ||
| import land.leets.domain.application.exception.ApplicationNotFoundException | ||
| import land.leets.domain.application.type.ApplicationStatus | ||
| import land.leets.domain.interview.domain.Interview | ||
| import land.leets.domain.interview.domain.repository.InterviewRepository | ||
| import land.leets.domain.interview.type.HasInterview | ||
| import java.time.LocalDateTime | ||
| import java.util.UUID | ||
|
|
||
| class GetApplicationStatusImplTest : DescribeSpec({ | ||
|
|
||
| val applicationRepository = mockk<ApplicationRepository>() | ||
| val interviewRepository = mockk<InterviewRepository>() | ||
| val getApplicationStatus = GetApplicationStatusImpl(applicationRepository, interviewRepository) | ||
|
|
||
| val uid = UUID.randomUUID() | ||
|
|
||
| val interviewDate: LocalDateTime = LocalDateTime.of(2026, 3, 14, 14, 0) | ||
| val interviewPlace = "전자정보도서관 1층 스터디룸 A" | ||
| val applicationId = 1L | ||
|
|
||
| fun mockApplication( | ||
| status: ApplicationStatus, | ||
| ): Application = mockk<Application>().also { application -> | ||
| every { application.id } returns applicationId | ||
| every { application.applicationStatus } returns status | ||
| } | ||
|
|
||
| fun mockInterview( | ||
| hasInterview: HasInterview = HasInterview.PENDING, | ||
| ): Interview = mockk<Interview>().also { interview -> | ||
| every { interview.hasInterview } returns hasInterview | ||
| every { interview.fixedInterviewDate } returns interviewDate | ||
| every { interview.place } returns interviewPlace | ||
| } | ||
|
|
||
| describe("GetApplicationStatusImpl 유스케이스는") { | ||
|
|
||
| context("지원서 상태 조회를 요청할 때") { | ||
|
|
||
| it("지원서 상태가 PASS_PAPER이면 인터뷰 정보를 포함하여 반환한다") { | ||
| val application = mockApplication(status = ApplicationStatus.PASS_PAPER) | ||
| val interview = mockInterview() | ||
| every { applicationRepository.findByUser_Id(uid) } returns application | ||
| every { interviewRepository.findByApplication(application) } returns interview | ||
|
|
||
| val result = getApplicationStatus.execute(uid) | ||
|
|
||
| result.id shouldBe 1L | ||
| result.status shouldBe ApplicationStatus.PASS_PAPER | ||
| result.hasInterview shouldBe HasInterview.PENDING | ||
| result.interviewDate shouldBe interviewDate | ||
| result.interviewPlace shouldBe interviewPlace | ||
| } | ||
|
|
||
| it("PASS_PAPER이 아닌 상태들은 인터뷰 정보가 null이어야 한다") { | ||
| val nonInterviewStatuses = listOf( | ||
| ApplicationStatus.PENDING, | ||
| ApplicationStatus.FAIL_PAPER, | ||
| ApplicationStatus.PASS, | ||
| ApplicationStatus.FAIL, | ||
| ) | ||
|
|
||
| nonInterviewStatuses.forEach { status -> | ||
| val application = mockApplication(status = status) | ||
| val interview = mockInterview() | ||
| every { applicationRepository.findByUser_Id(uid) } returns application | ||
| every { interviewRepository.findByApplication(application) } returns interview | ||
|
|
||
| val result = getApplicationStatus.execute(uid) | ||
|
|
||
| result.id shouldBe 1L | ||
| result.status shouldBe status | ||
| result.hasInterview shouldBe null | ||
| result.interviewDate shouldBe null | ||
| result.interviewPlace shouldBe null | ||
| } | ||
| } | ||
|
|
||
| it("지원서가 존재하지 않으면 ApplicationNotFoundException을 던진다") { | ||
| every { applicationRepository.findByUser_Id(uid) } returns null | ||
|
|
||
| shouldThrow<ApplicationNotFoundException> { | ||
| getApplicationStatus.execute(uid) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The conditional logic for returning interview information based on application status would benefit from a comment explaining the business rule. This would help future maintainers understand why interview details are only included for PASS_PAPER status.
Consider adding a brief comment like: "// Interview details are only shown to applicants who passed the paper screening"