-
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.
- Loading branch information
Showing
31 changed files
with
347 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
# 構成 | ||
|
||
**DDD-based Hexagonal Architecture** | ||
- Primary Port... HttpHandler | ||
- Hub... Domain, UseCase, Service | ||
- Secondary Port... DataSource/DataStore | ||
|
||
## ユースケース | ||
|
||
- 認証 | ||
- 科目を閲覧する | ||
|
||
|
||
- 申請履歴を閲覧する | ||
- 申請する | ||
- 事前申請と先着申請 | ||
- キャンセルする | ||
|
||
|
||
- 抽選する | ||
- 登録する |
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
File renamed without changes.
Empty file.
This file was deleted.
Oops, something went wrong.
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 data.repository | ||
|
||
interface CourseMembersRepository { | ||
fun save() | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/data/repository/CourseTakingApplicationListsRepository.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,14 @@ | ||
package data.repository | ||
|
||
import domain.entity.CourseTakingApplication | ||
import domain.entity.CourseTakingApplicationId | ||
import domain.entity.CourseTakingApplicationList | ||
import domain.entity.StudentId | ||
|
||
interface CourseTakingApplicationListsRepository { | ||
|
||
/*TODO: ApplicationList生成生成責務はここが持っている*/ | ||
suspend fun findByStudentId(studentId: StudentId): CourseTakingApplicationList | ||
suspend fun save(courseTakingApplicationList: CourseTakingApplicationList) | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/kotlin/data/repository/CourseTakingApplicationsHistoryRepository.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,7 @@ | ||
package data.repository | ||
|
||
interface CourseTakingApplicationsHistoryRepository { | ||
suspend fun findAll() | ||
suspend fun delete() | ||
suspend fun save() | ||
} |
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 data.repository | ||
|
||
interface CoursesRepository { | ||
suspend fun findAll() | ||
} |
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 data.repository | ||
|
||
interface StudentsRepository { | ||
suspend fun findById() | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/data/repository/impl/FakeCourseMembersRepository.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,9 @@ | ||
package data.repository.impl | ||
|
||
import data.repository.CourseMembersRepository | ||
|
||
class FakeCourseMembersRepository : CourseMembersRepository { | ||
override fun save() { | ||
TODO("Not yet implemented") | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/kotlin/data/repository/impl/FakeCourseTakingApplicationsHistoryRepository.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,17 @@ | ||
package data.repository.impl | ||
|
||
import data.repository.CourseTakingApplicationsHistoryRepository | ||
|
||
class FakeCourseTakingApplicationsHistoryRepository : CourseTakingApplicationsHistoryRepository { | ||
override suspend fun findAll() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun delete() { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun save() { | ||
TODO("Not yet implemented") | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/data/repository/impl/FakeCourseTakingApplicationsRepository.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,15 @@ | ||
package data.repository.impl | ||
|
||
import data.repository.CourseTakingApplicationListsRepository | ||
import domain.entity.CourseTakingApplicationList | ||
import domain.entity.StudentId | ||
|
||
class FakeCourseTakingApplicationsRepository : CourseTakingApplicationListsRepository { | ||
override suspend fun findByStudentId(studentId: StudentId): CourseTakingApplicationList { | ||
TODO("Not yet implemented") | ||
} | ||
|
||
override suspend fun save(courseTakingApplicationList: CourseTakingApplicationList) { | ||
TODO("Not yet implemented") | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/data/repository/impl/FakeCoursesRepository.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,9 @@ | ||
package data.repository.impl | ||
|
||
import data.repository.CoursesRepository | ||
|
||
class FakeCoursesRepository : CoursesRepository { | ||
override suspend fun findAll() { | ||
TODO("Not yet implemented") | ||
} | ||
} |
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,9 @@ | ||
package data.repository.impl | ||
|
||
import data.repository.StudentsRepository | ||
|
||
class FakeStudentsRepository : StudentsRepository { | ||
override suspend fun findById() { | ||
TODO("Not yet implemented") | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,9 @@ | ||
package domain | ||
|
||
interface IHub { | ||
|
||
} | ||
|
||
class Hub: IHub { | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/domain/CourseList.kt → src/main/kotlin/domain/entity/CourseList.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package domain | ||
package domain.entity | ||
|
||
class CourseList() { | ||
fun getCourseList(): List<Course> = TODO() | ||
|
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,44 @@ | ||
package domain.entity | ||
|
||
import domain.entity.common.Identifier | ||
import java.util.UUID | ||
|
||
typealias CourseTakingApplicationId = Identifier<CourseTakingApplication, String> | ||
|
||
class CourseTakingApplication( | ||
id: CourseTakingApplicationId, | ||
courseId: CourseId, | ||
status: Status | ||
) { | ||
private val _id = id | ||
private val _courseId = courseId | ||
private var _status = status | ||
|
||
fun getId(): CourseTakingApplicationId { | ||
return _id | ||
} | ||
|
||
fun getCourseId(): CourseId { | ||
return _courseId | ||
} | ||
|
||
fun getStatus(): Status { | ||
return _status | ||
} | ||
|
||
/*登録される*/ | ||
fun confirm(){ | ||
_status = Status.UNCONFIRMED | ||
} | ||
|
||
/*抽選で落選する*/ | ||
fun invalidate(){ | ||
_status = Status.INVALIDATED | ||
} | ||
|
||
|
||
} | ||
|
||
enum class Status { | ||
UNCONFIRMED, CONFIRMED, INVALIDATED | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/kotlin/domain/entity/CourseTakingApplicationList.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 domain.entity | ||
|
||
import java.util.* | ||
|
||
class CourseTakingApplicationList( | ||
studentId: StudentId | ||
) { | ||
private var _courseTakingApplicationList = mutableListOf<CourseTakingApplication>() | ||
fun createCourseTakingApplication(courseTakingApplicationId: CourseTakingApplicationId, courseId: CourseId){ | ||
val newApplication = CourseTakingApplication(courseTakingApplicationId, courseId, Status.UNCONFIRMED) | ||
_courseTakingApplicationList.add(newApplication) | ||
} | ||
fun deleteCourseTakingApplication(courseTakingApplicationId: CourseTakingApplicationId){ | ||
_courseTakingApplicationList.removeIf { courseTakingApplication -> | ||
courseTakingApplication.getId() == courseTakingApplicationId | ||
} | ||
} | ||
} |
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
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/domain/Identifier.kt → ...kotlin/domain/entity/common/Identifier.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package domain | ||
package domain.entity.common | ||
|
||
|
||
data class Identifier<EntityT, RawT>(val raw: RawT) | ||
|
2 changes: 1 addition & 1 deletion
2
src/main/kotlin/domain/courseTakingHub.kt → ...n/kotlin/domain/entity/courseTakingHub.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package domain | ||
package domain.entity | ||
|
||
interface CourseTakingHub{ | ||
|
||
|
10 changes: 5 additions & 5 deletions
10
...otlin/domain/CourseRegistrationManager.kt → ...main/service/CourseRegistrationService.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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
package domain | ||
package domain.service | ||
|
||
class CourseRegistrationManager { | ||
import domain.entity.CourseTakingApplication | ||
|
||
interface CourseRegistrationService { | ||
|
||
fun drawing(courseTakingApplicationList: List<CourseTakingApplication>): List<CourseTakingApplication> | ||
= TODO("抽選") | ||
|
||
fun registerMembers(courseTakingApplicationList: List<CourseTakingApplication>):Nothing = | ||
TODO("登録する") | ||
fun registerMembers(courseTakingApplicationList: List<CourseTakingApplication>) | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/domain/service/CourseTakingApplicationService.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,13 @@ | ||
package domain.service | ||
|
||
import domain.entity.CourseId | ||
import domain.entity.CourseTakingApplicationId | ||
import domain.entity.StudentId | ||
import org.http4k.core.Request | ||
interface CourseTakingApplicationService { | ||
val firstServedState :Boolean | ||
suspend fun applyCourseTaking(courseTakingApplicationId: CourseTakingApplicationId, studentId:StudentId, courseId: CourseId) | ||
|
||
suspend fun cancelCourseTaking(studentId:StudentId,courseTakingApplicationId: CourseTakingApplicationId) | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
src/main/kotlin/domain/service/impl/CourseTakingApplicationServiceImpl.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,41 @@ | ||
package domain.service.impl | ||
|
||
import data.repository.CourseTakingApplicationListsRepository | ||
import domain.entity.* | ||
import domain.service.CourseTakingApplicationService | ||
import org.http4k.core.Request | ||
|
||
/* | ||
* 履修の申請に関する機能を提供するクラス | ||
* | ||
* */ | ||
class CourseTakingApplicationServiceImpl( | ||
val repository: CourseTakingApplicationListsRepository | ||
) : CourseTakingApplicationService { | ||
|
||
override val firstServedState: Boolean | ||
get() = TODO("Not yet implemented") | ||
|
||
override suspend fun applyCourseTaking( | ||
courseTakingApplicationId: CourseTakingApplicationId, | ||
studentId: StudentId, | ||
courseId: CourseId | ||
) { | ||
val courseTakingApplicationList = getCourseTakingApplicationList(studentId) | ||
courseTakingApplicationList.createCourseTakingApplication(courseTakingApplicationId, courseId) | ||
repository.save(courseTakingApplicationList) | ||
} | ||
|
||
override suspend fun cancelCourseTaking( | ||
studentId: StudentId, | ||
courseTakingApplicationId: CourseTakingApplicationId | ||
) { | ||
val courseTakingApplicationList = getCourseTakingApplicationList(studentId) | ||
courseTakingApplicationList.deleteCourseTakingApplication(courseTakingApplicationId) | ||
repository.save(courseTakingApplicationList) | ||
} | ||
|
||
private suspend fun getCourseTakingApplicationList(studentId: StudentId): CourseTakingApplicationList { | ||
return repository.findByStudentId(studentId) | ||
} | ||
} |
Oops, something went wrong.