Commit 02247888 authored by Fjen Undso's avatar Fjen Undso
Browse files

models: add enums for votes

parent 04783ae7
......@@ -2,7 +2,6 @@ package models;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
......@@ -11,6 +10,8 @@ import play.data.format.Formats;
import play.data.validation.Constraints;
import play.db.ebean.Model;
import com.avaje.ebean.annotation.EnumValue;
@Entity
public class QuestionAnswer extends Model {
......@@ -26,7 +27,21 @@ public class QuestionAnswer extends Model {
@Formats.DateTime(pattern = "yyyy-MM-dd HH:mm:ss")
public Date date = new Date();
@Column(nullable = true)
public Integer vote;
@Constraints.Required
public Answer answer;
public enum Answer {
@EnumValue("A")
A,
@EnumValue("B")
B,
@EnumValue("C")
C,
@EnumValue("D")
D,
}
}
......@@ -11,6 +11,8 @@ import play.data.format.Formats;
import play.data.validation.Constraints;
import play.db.ebean.Model;
import com.avaje.ebean.annotation.EnumValue;
@Entity
public class Vote extends Model {
......@@ -28,5 +30,19 @@ public class Vote extends Model {
@Column(nullable = true)
public Integer vote;
@Constraints.Required
public Type type;
public enum Type {
@EnumValue("S")
SPEED,
@EnumValue("C")
COMPREHENSIBILITY,
@EnumValue("A")
ANNOUNCEMENT,
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment