diff --git a/src/main/scala/org/broadinstitute/dsde/firecloud/model/ModelJsonProtocol.scala b/src/main/scala/org/broadinstitute/dsde/firecloud/model/ModelJsonProtocol.scala index 11a6d887f..6cb81f926 100644 --- a/src/main/scala/org/broadinstitute/dsde/firecloud/model/ModelJsonProtocol.scala +++ b/src/main/scala/org/broadinstitute/dsde/firecloud/model/ModelJsonProtocol.scala @@ -213,8 +213,8 @@ object ModelJsonProtocol extends WorkspaceJsonSupport with SprayJsonSupport { implicit val impFireCloudKeyValue = jsonFormat2(FireCloudKeyValue) implicit val impThurloeKeyValue = jsonFormat2(ThurloeKeyValue) implicit val impThurloeKeyValues = jsonFormat2(ThurloeKeyValues) - implicit val impBasicProfile = jsonFormat10(BasicProfile) - implicit val impProfile = jsonFormat11(Profile.apply) + implicit val impBasicProfile = jsonFormat12(BasicProfile) + implicit val impProfile = jsonFormat13(Profile.apply) implicit val impProfileWrapper = jsonFormat2(ProfileWrapper) implicit val impProfileKVP = jsonFormat2(ProfileKVP) implicit val impTerraPreference = jsonFormat2(TerraPreference) diff --git a/src/main/scala/org/broadinstitute/dsde/firecloud/model/Profile.scala b/src/main/scala/org/broadinstitute/dsde/firecloud/model/Profile.scala index 91d8a32ab..fac03b5d6 100644 --- a/src/main/scala/org/broadinstitute/dsde/firecloud/model/Profile.scala +++ b/src/main/scala/org/broadinstitute/dsde/firecloud/model/Profile.scala @@ -29,7 +29,9 @@ case class BasicProfile ( programLocationState: String, programLocationCountry: String, termsOfService: Option[String], - researchArea: Option[String] + researchArea: Option[String], + department: String, + interestInTerra: Option[String], ) extends mappedPropVals { require(ProfileValidator.nonEmpty(firstName), "first name must be non-empty") require(ProfileValidator.nonEmpty(lastName), "last name must be non-empty") @@ -39,6 +41,7 @@ case class BasicProfile ( require(ProfileValidator.nonEmpty(programLocationCity), "program location city must be non-empty") require(ProfileValidator.nonEmpty(programLocationState), "program location state must be non-empty") require(ProfileValidator.nonEmpty(programLocationCountry), "program location country must be non-empty") + require(ProfileValidator.nonEmpty(department), "department must be non-empty") } case class Profile ( @@ -52,7 +55,9 @@ case class Profile ( programLocationCountry: String, researchArea: Option[String], linkedNihUsername: Option[String] = None, - linkExpireTime: Option[Long] = None + linkExpireTime: Option[Long] = None, + department: String, + interestInTerra: Option[String], ) extends mappedPropVals { require(ProfileValidator.nonEmpty(firstName), "first name must be non-empty") require(ProfileValidator.nonEmpty(lastName), "last name must be non-empty") @@ -62,14 +67,15 @@ case class Profile ( require(ProfileValidator.nonEmpty(programLocationCity), "program location city must be non-empty") require(ProfileValidator.nonEmpty(programLocationState), "program location state must be non-empty") require(ProfileValidator.nonEmpty(programLocationCountry), "program location country must be non-empty") + require(ProfileValidator.nonEmpty(department), "department must be non-empty") } object Profile { // increment this number every time you make a change to the user-provided profile fields - val currentVersion:Int = 4 + val currentVersion:Int = 5 - val requiredKeys = List("firstName", "lastName", "title", "institute", "programLocationCity", + val requiredKeys = List("firstName", "lastName", "title", "institute", "department", "programLocationCity", "programLocationState", "programLocationCountry") def apply(wrapper: ProfileWrapper): Profile = { @@ -95,7 +101,9 @@ object Profile { linkExpireTime = mappedKVPs.get("linkExpireTime") match { case Some(time) => Some(time.toLong) case _ => None - } + }, + department = mappedKVPs("department"), + interestInTerra = mappedKVPs.get("interestInTerra") ) } diff --git a/src/test/scala/org/broadinstitute/dsde/firecloud/model/ProfileSpec.scala b/src/test/scala/org/broadinstitute/dsde/firecloud/model/ProfileSpec.scala index 335b87614..3e3e71ad5 100644 --- a/src/test/scala/org/broadinstitute/dsde/firecloud/model/ProfileSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/firecloud/model/ProfileSpec.scala @@ -23,7 +23,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { programLocationCity = randomString, programLocationState = randomString, programLocationCountry = randomString, - termsOfService = Some(termsOfServiceUrl) + termsOfService = Some(termsOfServiceUrl), + department = randomString, + interestInTerra = Some(randomString) ) basicProfile shouldNot be(null) } @@ -38,7 +40,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { programLocationCity = randomString, programLocationState = randomString, programLocationCountry = randomString, - termsOfService = Some(termsOfServiceUrl) + termsOfService = Some(termsOfServiceUrl), + department = randomString, + interestInTerra = Some(randomString) ) basicProfile shouldNot be(null) } @@ -52,7 +56,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { researchArea = Some(randomString), programLocationCity = randomString, programLocationState = randomString, - programLocationCountry = randomString + programLocationCountry = randomString, + department = randomString, + interestInTerra = Some(randomString) ) profile shouldNot be(null) } @@ -66,7 +72,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { researchArea = Some(randomString), programLocationCity = randomString, programLocationState = randomString, - programLocationCountry = randomString + programLocationCountry = randomString, + department = randomString, + interestInTerra = Some(randomString) ) profile shouldNot be(null) } @@ -80,7 +88,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { researchArea = Some(randomString), programLocationCity = randomString, programLocationState = randomString, - programLocationCountry = randomString + programLocationCountry = randomString, + department = randomString, + interestInTerra = Some(randomString) ) profile shouldNot be(null) } @@ -99,6 +109,8 @@ class ProfileSpec extends AnyFreeSpec with Matchers { programLocationState = "", programLocationCountry = "", None, + None, + "", None ) } @@ -115,7 +127,9 @@ class ProfileSpec extends AnyFreeSpec with Matchers { researchArea = Some(randomString), programLocationCity = randomString, programLocationState = randomString, - programLocationCountry = randomString + programLocationCountry = randomString, + department = randomString, + interestInTerra = Some(randomString) ) } ex shouldNot be(null) diff --git a/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/RegisterApiServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/RegisterApiServiceSpec.scala index 6cc4cd0c7..7271c5394 100644 --- a/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/RegisterApiServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/RegisterApiServiceSpec.scala @@ -164,7 +164,9 @@ final class RegisterApiServiceSpec extends BaseServiceSpec with RegisterApiServi programLocationCity = randomString, programLocationState = randomString, programLocationCountry = randomString, - termsOfService = if (hasTermsOfService) Some(termsOfServiceUrl) else None + termsOfService = if (hasTermsOfService) Some(termsOfServiceUrl) else None, + department = randomString, + interestInTerra = Some(randomString) ) } } diff --git a/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/UserApiServiceSpec.scala b/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/UserApiServiceSpec.scala index 524ff45ea..a06395938 100644 --- a/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/UserApiServiceSpec.scala +++ b/src/test/scala/org/broadinstitute/dsde/firecloud/webservice/UserApiServiceSpec.scala @@ -48,7 +48,9 @@ class UserApiServiceSpec extends BaseServiceSpec with SamMockserverUtils programLocationCity = randomAlpha(), programLocationState = randomAlpha(), programLocationCountry = randomAlpha(), - termsOfService = None + termsOfService = None, + department = randomAlpha(), + interestInTerra = Some(randomAlpha()) ) val allProperties: Map[String, String] = fullProfile.propertyValueMap