-
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.
Browse files
Browse the repository at this point in the history
* feat: BrowseProblemsUseCase 구현 * feat: browseProblemsUseCase 컨트롤러에 반영
- Loading branch information
1 parent
17ee380
commit 72bda63
Showing
6 changed files
with
112 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
api/src/main/kotlin/com/few/api/domain/problem/usecase/BrowseProblemsUseCase.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,21 @@ | ||
package com.few.api.domain.problem.usecase | ||
|
||
import com.few.api.domain.problem.usecase.`in`.BrowseProblemsUseCaseIn | ||
import com.few.api.domain.problem.usecase.out.BrowseProblemsUseCaseOut | ||
import com.few.api.repo.dao.problem.ProblemDao | ||
import com.few.api.repo.dao.problem.query.SelectProblemsByArticleIdQuery | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class BrowseProblemsUseCase( | ||
private val problemDao: ProblemDao | ||
) { | ||
|
||
fun execute(useCaseIn: BrowseProblemsUseCaseIn): BrowseProblemsUseCaseOut { | ||
SelectProblemsByArticleIdQuery(useCaseIn.articleId).let { query: SelectProblemsByArticleIdQuery -> | ||
problemDao.selectProblemsByArticleId(query) ?: throw IllegalArgumentException("cannot find problems by articleId: ${query.articleId}") // todo 에러 표준화 | ||
}.let { | ||
return BrowseProblemsUseCaseOut(it.problemIds) | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
api/src/main/kotlin/com/few/api/domain/problem/usecase/in/BrowseProblemsUseCaseIn.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,5 @@ | ||
package com.few.api.domain.problem.usecase.`in` | ||
|
||
data class BrowseProblemsUseCaseIn( | ||
val articleId: Long | ||
) |
5 changes: 5 additions & 0 deletions
5
api/src/main/kotlin/com/few/api/domain/problem/usecase/out/BrowseProblemsUseCaseOut.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,5 @@ | ||
package com.few.api.domain.problem.usecase.out | ||
|
||
data class BrowseProblemsUseCaseOut( | ||
val problemIds: List<Long> | ||
) |
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
5 changes: 5 additions & 0 deletions
5
api/src/main/kotlin/com/few/api/web/controller/problem/response/BrowseProblemsResponse.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,5 @@ | ||
package com.few.api.web.controller.problem.response | ||
|
||
data class BrowseProblemsResponse( | ||
val problemIds: List<Long> | ||
) |
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