File tree 1 file changed +6
-6
lines changed
src/main/kotlin/me/nalab/api/core
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -15,21 +15,21 @@ abstract class TimeBaseEntity {
15
15
nullable = false ,
16
16
updatable = false ,
17
17
)
18
- protected var createdAt: Instant ? = null
18
+ protected lateinit var createdAt: Instant
19
19
20
20
@Column(name = " updated_at" , columnDefinition = " TIMESTAMP(6)" , nullable = false )
21
- protected var updatedAt: Instant ? = null
21
+ protected lateinit var updatedAt: Instant
22
22
23
23
@PrePersist
24
24
fun prePersist () {
25
- val now = Instant .now()
26
- createdAt = if (createdAt != null ) createdAt else now
27
- updatedAt = if (updatedAt != null ) updatedAt else now
25
+ val now = TimeUtil .now()
26
+ createdAt = now
27
+ updatedAt = now
28
28
}
29
29
30
30
@PreUpdate
31
31
fun preUpdate () {
32
- updatedAt = Instant .now()
32
+ updatedAt = TimeUtil .now()
33
33
}
34
34
}
35
35
You can’t perform that action at this time.
0 commit comments