Slide 53
Slide 53 text
Entities
ビジネスロジック
def reservedAuthorization(responseType: String,
redirectUri: Option[String],
scope: Option[Seq[String]],
state: Option[String]): EntitiesValidationResult[ReservedAuthorization] =
(assertResponseType(responseType), assertRedirectUri(redirectUri), assertScope(scope), assertState(state)) mapN {
case (_responseType, _redirectUri, _scope, _state) =>
ReservedAuthorization(
id = ReservedAuthorizationId(RefKeyGenerator.generate.value),
status = Status.Active,
responseType = _responseType,
clientId = this.id,
redirectUri = _redirectUri,
scopes = _scope,
state = _state,
createdAt = ZonedDateTime.now,
updatedAt = None
)
}
EntitiesValidationResult
は、Type
エイリアス
assertXXX
で事前条件を確認している
実践 Clean Architecture
Scala
福岡 2019 42 / 46