-
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.
Migrate Club entity in the domain and presentation layer
- Loading branch information
1 parent
eb7e6fa
commit d8bbc15
Showing
29 changed files
with
162 additions
and
167 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...ntegration-test/kotlin/tech/coner/trailer/app/admin/util/ConerTrailerCliProcessFactory.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
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
2 changes: 1 addition & 1 deletion
2
...rc/main/kotlin/tech/coner/trailer/Club.kt → .../tech/coner/trailer/domain/entity/Club.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 tech.coner.trailer | ||
package tech.coner.trailer.domain.entity | ||
|
||
data class Club( | ||
val name: String | ||
|
18 changes: 18 additions & 0 deletions
18
core/src/main/kotlin/tech/coner/trailer/domain/validation/ClubFeedback.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 tech.coner.trailer.domain.validation | ||
|
||
import tech.coner.trailer.domain.entity.Club | ||
import tech.coner.trailer.toolkit.validation.Feedback | ||
import tech.coner.trailer.toolkit.validation.Severity | ||
|
||
sealed class ClubFeedback : Feedback<Club> { | ||
|
||
override val severity = Severity.Error | ||
|
||
data object NameMustNotBeBlank : ClubFeedback() { | ||
override val property = Club::name | ||
} | ||
|
||
data object NameMustNotExceedMaxLength : ClubFeedback() { | ||
override val property = Club::name | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
core/src/main/kotlin/tech/coner/trailer/domain/validation/ClubValidator.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 tech.coner.trailer.domain.validation | ||
|
||
import tech.coner.trailer.domain.entity.Club | ||
import tech.coner.trailer.domain.validation.ClubFeedback.NameMustNotBeBlank | ||
import tech.coner.trailer.domain.validation.ClubFeedback.NameMustNotExceedMaxLength | ||
import tech.coner.trailer.toolkit.validation.Validator | ||
|
||
typealias ClubValidator = Validator<Unit, Club, ClubFeedback> | ||
|
||
fun ClubValidator() = Validator<Unit, Club, ClubFeedback> { | ||
Club::name { name -> NameMustNotBeBlank.takeUnless { name.isNotBlank() } } | ||
Club::name { name -> NameMustNotExceedMaxLength.takeUnless { name.length <= Club.NAME_MAX_LENGTH } } | ||
} |
2 changes: 1 addition & 1 deletion
2
io/src/main/kotlin/tech/coner/trailer/io/constraint/ClubPersistConstraints.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
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
25 changes: 0 additions & 25 deletions
25
...tion/presentation/src/main/kotlin/tech/coner/trailer/presentation/adapter/ClubAdapters.kt
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
29 changes: 10 additions & 19 deletions
29
...sentation/src/main/kotlin/tech/coner/trailer/presentation/di/presenter/PresenterModule.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
18 changes: 0 additions & 18 deletions
18
presentation/presentation/src/main/kotlin/tech/coner/trailer/presentation/model/ClubModel.kt
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
...ntation/src/main/kotlin/tech/coner/trailer/presentation/model/club/ClubDetailItemModel.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 tech.coner.trailer.presentation.model.club | ||
|
||
import tech.coner.trailer.domain.validation.ClubValidator | ||
import tech.coner.trailer.toolkit.presentation.model.BaseItemModel | ||
import tech.coner.trailer.toolkit.validation.Validator | ||
|
||
class ClubDetailItemModel( | ||
override val initialItem: ClubDetailModel, | ||
private val adapter: ClubEntityModelAdapter = ClubEntityModelAdapter() | ||
) : BaseItemModel<ClubDetailModel, Unit, ClubDetailModelFeedback>() { | ||
|
||
override val validator: Validator<Unit, ClubDetailModel, ClubDetailModelFeedback> = Validator { | ||
input( | ||
otherTypeValidator = ClubValidator(), | ||
mapContextFn = {}, | ||
mapInputFn = { adapter.modelToEntityAdapter(it) }, | ||
mapFeedbackObjectFn = { ClubDetailModelFeedback(it) } | ||
) | ||
} | ||
override val validatorContext = Unit | ||
} |
7 changes: 7 additions & 0 deletions
7
...resentation/src/main/kotlin/tech/coner/trailer/presentation/model/club/ClubDetailModel.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 tech.coner.trailer.presentation.model.club | ||
|
||
import tech.coner.trailer.toolkit.presentation.model.Model | ||
|
||
data class ClubDetailModel( | ||
val name: String | ||
) : Model |
16 changes: 16 additions & 0 deletions
16
...ion/src/main/kotlin/tech/coner/trailer/presentation/model/club/ClubDetailModelFeedback.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,16 @@ | ||
package tech.coner.trailer.presentation.model.club | ||
|
||
import tech.coner.trailer.domain.entity.Club | ||
import tech.coner.trailer.domain.validation.ClubFeedback | ||
import tech.coner.trailer.toolkit.validation.Feedback | ||
import tech.coner.trailer.toolkit.validation.FeedbackDelegate | ||
import tech.coner.trailer.toolkit.validation.adapter.propertyAdapterOf | ||
|
||
data class ClubDetailModelFeedback( | ||
val source: ClubFeedback | ||
) : Feedback<ClubDetailModel> by FeedbackDelegate( | ||
feedback = source, | ||
propertyAdapter = propertyAdapterOf( | ||
Club::name to ClubDetailModel::name | ||
) | ||
) |
17 changes: 17 additions & 0 deletions
17
...tion/src/main/kotlin/tech/coner/trailer/presentation/model/club/ClubEntityModelAdapter.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 tech.coner.trailer.presentation.model.club | ||
|
||
import tech.coner.trailer.domain.entity.Club | ||
import tech.coner.trailer.toolkit.presentation.adapter.EntityModelAdapter | ||
|
||
class ClubEntityModelAdapter : EntityModelAdapter<Club, ClubDetailModel>() { | ||
override val entityToModelAdapter: (Club) -> ClubDetailModel = { | ||
ClubDetailModel( | ||
name = it.name | ||
) | ||
} | ||
override val modelToEntityAdapter: (ClubDetailModel) -> Club = { | ||
Club( | ||
name = it.name | ||
) | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...ion/src/main/kotlin/tech/coner/trailer/presentation/presenter/club/ClubDetailPresenter.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,10 @@ | ||
package tech.coner.trailer.presentation.presenter.club | ||
|
||
import tech.coner.trailer.presentation.state.club.ClubDetailState | ||
import tech.coner.trailer.toolkit.presentation.model.Loadable | ||
|
||
class ClubDetailPresenter( | ||
initialState: ClubDetailState = ClubDetailState(loadable = Loadable.Empty()) | ||
) { | ||
|
||
} |
32 changes: 0 additions & 32 deletions
32
...sentation/src/main/kotlin/tech/coner/trailer/presentation/presenter/club/ClubPresenter.kt
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...rc/main/kotlin/tech/coner/trailer/presentation/presenter/club/SecondDraftClubPresenter.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.