Created
June 2, 2017 14:38
-
-
Save derekmorr/8e18ac852efbd1fa9c56739f73fc3241 to your computer and use it in GitHub Desktop.
helping in gitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.time.Instant | |
import com.lunaryorn.refined.play.json._ | |
import controllers.json.types.NumericString | |
import eu.timepit.refined.W | |
import eu.timepit.refined.api.Refined | |
import eu.timepit.refined.boolean.And | |
import eu.timepit.refined.char.Digit | |
import eu.timepit.refined.collection.{Forall, NonEmpty, Size} | |
import play.api.libs.json.{Format, Json} | |
object types { | |
type NumericString = String Refined Forall[Digit] // And[Size[W.`14`.T], Forall[Digit]] | |
} | |
case class Organization( | |
id: Int, | |
name: String, | |
siret: NumericString, | |
economicalActivities: Set[String], | |
areas: Set[String] = Set.empty, | |
documents: Set[String] = Set.empty, | |
createdAt: Instant = Instant.now(), | |
createdBy: Option[String], | |
deletedAt: Option[Instant] = None, | |
deletedBy: Option[String] = None | |
) | |
object Organization { | |
implicit val organizationFormat: Format[Organization] = Json.format[Organization] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment