iari
05/07/2020, 8:11 PMturansky
05/07/2020, 8:21 PMiari
05/07/2020, 8:31 PM@EntityListeners(AuditingEntityListener::class)
@Entity
@Inheritance
class Video(
        request: UploadVideoRequest,
        @get: NotBlank
        @NaturalId
        @Column(unique = true)
        val name: String,
        @get: NotNull
        val size: Long = 0,
        @get: NotBlank
        val url: String = ""
) {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    val id: Long = 0
    @Column(nullable = false, updatable = false, columnDefinition = "DATETIME(3)")
    @CreationTimestamp
    lateinit var created: LocalDateTime
    @Column(nullable = false, updatable = true, columnDefinition = "DATETIME(3)")
    @UpdateTimestamp
    lateinit var updated: LocalDateTime
    @ManyToOne
    @JoinColumn(nullable = false, updatable = false, referencedColumnName = "id")
    @CreatedBy
    lateinit var user: User
    @get: NotBlank
    val description: String = request.description
}turansky
05/07/2020, 9:49 PMturansky
05/07/2020, 9:51 PMturansky
05/07/2020, 9:51 PMiari
05/08/2020, 5:26 PMturansky
05/08/2020, 5:44 PMiari
05/08/2020, 6:02 PMturansky
05/08/2020, 6:13 PM// in common
actual class Video {
    val id: Long
    var created: LocalDateTime
    var updated: LocalDateTime
    var user: User
    val description: String = request.description
}
// in jvm
expected class Video ...iari
05/08/2020, 6:24 PMturansky
05/08/2020, 6:26 PMexpectediari
05/08/2020, 6:28 PMandylamax
06/12/2020, 1:50 AM