generated from pricelees/issue-pr-template
feat: 로그인 이력 저장을 위한 이벤트 객체 생성
This commit is contained in:
parent
4ec1e0c813
commit
076470b7ab
@ -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