Created
September 12, 2015 14:21
-
-
Save Hajto/a355b800f334a584a547 to your computer and use it in GitHub Desktop.
Trying to resolve problem
This file contains 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
package model | |
import play.api.data.Form | |
import play.api.libs.json.Json | |
import model.SkillFormats.skillRecordFormat | |
import play.api.data._ | |
import play.api.data.Forms._ | |
object UserFormats { | |
implicit val userForm = Form( | |
mapping( | |
"login" -> text, | |
"password" -> text | |
)(UserLoginData.apply)(UserLoginData.unapply) | |
) | |
implicit val registerForm = Form( | |
mapping( | |
"name" -> text, | |
"surname" -> text, | |
"login" -> text, | |
"password" -> text, | |
"email" -> text | |
) | |
)(User.apply)(User.unapply) | |
implicit val userFormat = Json.format[User] | |
} | |
case class UserLoginData(login: String, password: String) | |
object User { | |
def apply(name: String, surname: String, login: String, password: String, email: String) = | |
new User(name, surname, login, password, email, List()) | |
} | |
case class User(name: String, surname: String, login: String, password: String, email: String, skillSet: List[SkillRecord] = List()) { | |
// def apply(name: String, surname: String, login: String, password: String, email: String) = | |
// new User(name, surname, login, password, email, List()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment