Last active
July 8, 2021 19:12
-
-
Save jeroenr/64a30d1112dd2b89190cb8b6f7c27afa to your computer and use it in GitHub Desktop.
Entity example
This file contains hidden or 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
@Document | |
data class UserAccount( | |
@Id | |
val _id: ObjectId = ObjectId(), | |
var name: String, | |
var createdAt: Instant = Instant.now(), | |
var updatedAt: Instant = Instant.now() | |
) { | |
var auditTrail: List<String> = listOf() | |
fun updateName(name: String) { | |
this.auditTrail = auditTrail.plus( | |
“${this.name} -> ${name}” | |
) | |
this.name = name | |
this.updatedAt = Instant.now() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment