generated from pricelees/issue-pr-template
[#61] 커넥션 고갈 해결을 위한 로그인 이력 저장 비동기 처리 #62
@ -0,0 +1,19 @@
|
||||
package com.sangdol.roomescape.auth.business.domain
|
||||
|
||||
class LoginHistoryEvent(
|
||||
val id: Long,
|
||||
val type: PrincipalType,
|
||||
var success: Boolean = true,
|
||||
val ipAddress: String,
|
||||
val userAgent: String
|
||||
) {
|
||||
fun onSuccess(): LoginHistoryEvent {
|
||||
this.success = true
|
||||
return this
|
||||
}
|
||||
|
||||
fun onFailure(): LoginHistoryEvent {
|
||||
this.success = false
|
||||
return this
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.sangdol.roomescape.auth.mapper
|
||||
|
||||
import com.sangdol.roomescape.auth.business.domain.LoginHistoryEvent
|
||||
import com.sangdol.roomescape.auth.infrastructure.persistence.LoginHistoryEntity
|
||||
|
||||
fun LoginHistoryEvent.toEntity(id: Long) = LoginHistoryEntity(
|
||||
id = id,
|
||||
principalId = this.id,
|
||||
principalType = this.type,
|
||||
success = this.success,
|
||||
ipAddress = this.ipAddress,
|
||||
userAgent = this.userAgent
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user