VoteAggregation return total votes and the score

This commit is contained in:
2019-10-16 16:27:06 +02:00
parent 54393000b3
commit 32417d3276
4 changed files with 26 additions and 6 deletions

View File

@@ -5,5 +5,5 @@ interface Votable {
}
class VotableImp : Votable {
override var votes: VoteAggregation = VoteAggregation(0, 0, 0)
override var votes: VoteAggregation = VoteAggregation()
}

View File

@@ -7,6 +7,10 @@ import fr.postgresjson.entity.EntityUpdatedAtImp
open class VoteAggregation(
val up: Int,
val neutral: Int,
val down: Int
val down: Int,
val total: Int,
val score: Int
) : EntityI,
EntityUpdatedAt by EntityUpdatedAtImp()
EntityUpdatedAt by EntityUpdatedAtImp() {
constructor() : this(0, 0, 0, 0, 0)
}