-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from KUSITMS-29th-TEAM-B/feat/flight-64
feat : JD 작성 상태 변경 API 구현
- Loading branch information
Showing
13 changed files
with
184 additions
and
27 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
18 changes: 18 additions & 0 deletions
18
...nggang/apimodule/domain/jobDescription/application/service/JobDescriptionUpdateService.kt
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,18 @@ | ||
package com.bamyanggang.apimodule.domain.jobDescription.application.service | ||
|
||
import com.bamyanggang.domainmodule.domain.jobDescription.service.JobDescriptionModifier | ||
import com.bamyanggang.domainmodule.domain.jobDescription.service.JobDescriptionReader | ||
import org.springframework.stereotype.Service | ||
import java.util.* | ||
|
||
@Service | ||
class JobDescriptionUpdateService( | ||
private val jobDescriptionModifier: JobDescriptionModifier, | ||
private val jobDescriptionReader: JobDescriptionReader | ||
) { | ||
fun updateWriteStatus(jobDescriptionId: UUID) { | ||
val jobDescription = jobDescriptionReader.readJobDescriptionById(jobDescriptionId) | ||
jobDescriptionModifier.modifyWriteStatus(jobDescription) | ||
} | ||
|
||
} |
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
26 changes: 26 additions & 0 deletions
26
...amyanggang/apimodule/domain/jobDescription/application/JobDescriptionUpdateServiceTest.kt
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,26 @@ | ||
package com.bamyanggang.apimodule.domain.jobDescription.application | ||
|
||
import com.bamyanggang.apimodule.domain.jobDescription.application.service.JobDescriptionUpdateService | ||
import com.bamyanggang.domainmodule.domain.jobDescription.service.JobDescriptionModifier | ||
import com.bamyanggang.domainmodule.domain.jobDescription.service.JobDescriptionReader | ||
import io.kotest.core.spec.style.BehaviorSpec | ||
import io.mockk.mockk | ||
import io.mockk.verify | ||
import java.util.UUID | ||
|
||
class JobDescriptionUpdateServiceTest: BehaviorSpec({ | ||
val jobDescriptionModifier = mockk<JobDescriptionModifier>(relaxed = true) | ||
val jobDescriptionReader = mockk<JobDescriptionReader>(relaxed = true) | ||
val service = JobDescriptionUpdateService(jobDescriptionModifier, jobDescriptionReader) | ||
|
||
given("JobDescriptionUpdateService.updateWriteStatus") { | ||
val jobDescriptionId = UUID.randomUUID() | ||
`when`("직무 공고 id가 주어지면") { | ||
service.updateWriteStatus(jobDescriptionId) | ||
then("modifyWriteStatus가 호출된다.") { | ||
verify { jobDescriptionModifier.modifyWriteStatus(any()) } | ||
} | ||
} | ||
} | ||
|
||
}) |
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
20 changes: 20 additions & 0 deletions
20
...n/com/bamyanggang/domainmodule/domain/jobDescription/exception/JobDescriptionException.kt
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,20 @@ | ||
package com.bamyanggang.domainmodule.domain.jobDescription.exception | ||
|
||
import com.bamyanggang.commonmodule.exception.CustomException | ||
import org.springframework.http.HttpStatus | ||
import org.springframework.http.HttpStatusCode | ||
|
||
sealed class JobDescriptionException ( | ||
errorCode: Int, | ||
httpStatusCode: HttpStatusCode, | ||
message: String, | ||
) : CustomException(CODE_PREFIX, errorCode, httpStatusCode , message) { | ||
|
||
class ModifyWriteStatusFailed(message: String = "쓰기 상태 변경에 실패하였습니다.") : | ||
JobDescriptionException(errorCode = 1, httpStatusCode = HttpStatus.BAD_REQUEST, message = message) | ||
|
||
companion object { | ||
const val CODE_PREFIX = "AUTH" | ||
} | ||
|
||
} |
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
38 changes: 38 additions & 0 deletions
38
.../com/bamyanggang/domainmodule/domain/jobDescription/service/JobDescriptionModifierTest.kt
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,38 @@ | ||
package com.bamyanggang.domainmodule.domain.jobDescription.service | ||
|
||
import com.bamyanggang.commonmodule.fixture.generateFixture | ||
import com.bamyanggang.domainmodule.domain.jobDescription.aggregate.JobDescription | ||
import com.bamyanggang.domainmodule.domain.jobDescription.enums.WriteStatus | ||
import com.bamyanggang.domainmodule.domain.jobDescription.repository.JobDescriptionRepository | ||
import io.kotest.core.spec.style.BehaviorSpec | ||
import io.mockk.mockk | ||
import io.mockk.verify | ||
import java.time.LocalDateTime | ||
import java.util.* | ||
|
||
class JobDescriptionModifierTest: BehaviorSpec({ | ||
val jobDescriptionRepository = mockk<JobDescriptionRepository>(relaxed = true) | ||
val service = JobDescriptionModifier(jobDescriptionRepository) | ||
|
||
given("JobDescriptionModifier.modifyWriteStatus") { | ||
val jobDescription: JobDescription = generateFixture { | ||
it.set("enterpriseName", "기업 이름") | ||
it.set("title", "직무 공고 제목") | ||
it.set("writeStatus", WriteStatus.NOT_APPLIED) | ||
it.set("content", "직무 공고 내용") | ||
it.set("link", "직무 공고 링크") | ||
it.set("createdAt", LocalDateTime.now()) | ||
it.set("updatedAt", LocalDateTime.now()) | ||
it.set("startedAt", LocalDateTime.now()) | ||
it.set("endedAt", LocalDateTime.now().plusDays(1)) | ||
it.set("userId", UUID.randomUUID()) | ||
} | ||
`when`("jobDescription가 주어지면") { | ||
service.modifyWriteStatus(jobDescription) | ||
then("changeWriteStatus가 호출된다.") { | ||
verify { jobDescriptionRepository.save(any()) } | ||
} | ||
} | ||
} | ||
|
||
}) |