Skip to content

Commit

Permalink
#32 Add user attribute format
Browse files Browse the repository at this point in the history
  • Loading branch information
To-om committed Nov 20, 2017
1 parent e00a051 commit b6c6b5c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/org/elastic4play/models/Attributes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ object AttributeFormat {
val dateFmt = DateAttributeFormat
val textFmt = TextAttributeFormat
val stringFmt = StringAttributeFormat
val userFmt = UserAttributeFormat
val booleanFmt = BooleanAttributeFormat
val numberFmt = NumberAttributeFormat
val attachmentFmt = AttachmentAttributeFormat
Expand Down
4 changes: 2 additions & 2 deletions app/org/elastic4play/models/ModelDef.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ abstract class ModelAttributes(val name: String) extends AttributeDef {
attr
}

val createdBy = attribute("createdBy", AttributeFormat.stringFmt, "user who created this entity", None, AttributeOption.model, AttributeOption.readonly)
val createdBy = attribute("createdBy", AttributeFormat.userFmt, "user who created this entity", None, AttributeOption.model, AttributeOption.readonly)
val createdAt = attribute("createdAt", AttributeFormat.dateFmt, "user who created this entity", new Date, AttributeOption.model, AttributeOption.readonly)
val updatedBy = optionalAttribute("updatedBy", AttributeFormat.stringFmt, "user who created this entity", None, AttributeOption.model)
val updatedBy = optionalAttribute("updatedBy", AttributeFormat.userFmt, "user who created this entity", None, AttributeOption.model)
val updatedAt = optionalAttribute("updatedAt", AttributeFormat.dateFmt, "user who created this entity", AttributeOption.model)
}

Expand Down
7 changes: 7 additions & 0 deletions app/org/elastic4play/models/UserAttributeFormat.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.elastic4play.models

class UserAttributeFormat extends StringAttributeFormat {
override val name: String = "user"
}

object UserAttributeFormat extends UserAttributeFormat

0 comments on commit b6c6b5c

Please sign in to comment.