So far, we haven't created any data transfer objects (DTOs). It is time to do so. We will introduce two more fields. Extend the Note and Todo classes. Add created and modified fields:
- Note:
package com.journaler.api.data import com.fasterxml.jackson.annotation.JsonInclude import org.hibernate.annotations.CreationTimestamp import org.hibernate.annotations.GenericGenerator import org.hibernate.annotations.UpdateTimestamp import java.util.* import javax.persistence.* @Entity @Table(name = "note") @JsonInclude(JsonInclude.Include.NON_NULL) data class Note( ... @CreationTimestamp var created: Date = Date(), @UpdateTimestamp var modified: Date = Date() ) { ... }
- Todo:
package com.journaler.api.data import com.fasterxml.jackson.annotation.JsonInclude ...