feature #8: create Vote Article route

This commit is contained in:
2019-08-30 13:24:37 +02:00
parent 7a8f8d3d6a
commit 1b8a02c2b3
6 changed files with 115 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
package fr.dcproject.entity
import fr.postgresjson.entity.EntityUpdatedAt
import fr.postgresjson.entity.EntityUpdatedAtImp
import fr.postgresjson.entity.UuidEntity
import java.util.*
open class Vote <T: UuidEntity> (
id: UUID = UUID.randomUUID(),
createdBy: Citizen,
override var target: T,
var note: Int,
var annonymous: Boolean = true
): Extra<T>(id, createdBy),
EntityUpdatedAt by EntityUpdatedAtImp() {
init {
if (note > 1 && note < -1) {
error("note must be 1, 0 or -1")
}
}
}