From e0406b1636c99d7f55bfb9545bfd62c645b956da Mon Sep 17 00:00:00 2001 From: TAKESHI SHIMADA <> Date: Wed, 28 Nov 2018 23:01:37 +0900 Subject: [PATCH] cactacea-core : Change displayName type Option[String] to String (#160) --- .../db/migration/cactacea/V20181109__#160.sql | 9 ++++- .../interfaces/InjectionService.scala | 2 +- .../services/DefaultInjectionService.scala | 2 +- .../services/AccountsService.scala | 2 +- .../backend/core/domain/models/Account.scala | 4 +-- .../repositories/AccountsRepository.scala | 2 +- .../core/infrastructure/dao/AccountsDAO.scala | 15 ++++---- .../dao/PushNotificationsDAO.scala | 36 +++++++++---------- .../core/infrastructure/models/Accounts.scala | 2 +- .../repositories/AccountsRepositorySpec.scala | 2 +- .../repositories/SessionsRepositorySpec.scala | 7 ++-- .../cactacea/core/helpers/FactoryHelper.scala | 2 +- .../cactacea/core/helpers/ServiceSpec.scala | 2 +- .../infrastructure/dao/AccountsDAOSpec.scala | 8 ++--- .../infrastructure/dao/CommentsDAOSpec.scala | 2 +- .../requests/session/PutSessionProfile.scala | 2 +- 16 files changed, 51 insertions(+), 48 deletions(-) diff --git a/core/src/main/resources/db/migration/cactacea/V20181109__#160.sql b/core/src/main/resources/db/migration/cactacea/V20181109__#160.sql index a3b78910..bf57eb0d 100644 --- a/core/src/main/resources/db/migration/cactacea/V20181109__#160.sql +++ b/core/src/main/resources/db/migration/cactacea/V20181109__#160.sql @@ -5,6 +5,8 @@ -- Project: Name of the project -- Author: TAKESHI SHIMADA +SET SQL_SAFE_UPDATES = 0; + ALTER SCHEMA `cactacea` DEFAULT COLLATE utf8_general_ci ; ALTER TABLE `cactacea`.`account_feeds` @@ -123,4 +125,9 @@ ALTER TABLE `cactacea`.`groups` ADD COLUMN `last_posted_at` BIGINT(20) NULL DEFAULT NULL AFTER `message_id`; ALTER TABLE `cactacea`.`relationships` -CHANGE COLUMN `edited_display_name` `display_name` VARCHAR(50) NULL DEFAULT NULL ; \ No newline at end of file +CHANGE COLUMN `edited_display_name` `display_name` VARCHAR(50) NULL DEFAULT NULL ; + +UPDATE `cactacea`.`accounts` set display_name = account_name where display_name is null; + +ALTER TABLE `cactacea`.`accounts` +CHANGE COLUMN `display_name` `display_name` VARCHAR(50) NOT NULL DEFAULT ' ' ; diff --git a/core/src/main/scala/io/github/cactacea/backend/core/application/components/interfaces/InjectionService.scala b/core/src/main/scala/io/github/cactacea/backend/core/application/components/interfaces/InjectionService.scala index 271a768c..e3166965 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/application/components/interfaces/InjectionService.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/application/components/interfaces/InjectionService.scala @@ -10,7 +10,7 @@ trait InjectionService { def signedIn(authentication: Account): Future[Unit] def signedOut(sessionId: SessionId): Future[Unit] def accountNameUpdated(accountName: String, sessionId: SessionId): Future[Unit] - def profileUpdated(displayName: Option[String], web: Option[String], birthday: Option[Long], location: Option[String], + def profileUpdated(displayName: String, web: Option[String], birthday: Option[Long], location: Option[String], bio: Option[String], sessionId: SessionId): Future[Unit] def profileImageUpdated(profileImageUri: Option[String], sessionId: SessionId): Future[Unit] def passwordUpdated(sessionId: SessionId): Future[Unit] diff --git a/core/src/main/scala/io/github/cactacea/backend/core/application/components/services/DefaultInjectionService.scala b/core/src/main/scala/io/github/cactacea/backend/core/application/components/services/DefaultInjectionService.scala index a41766c4..e7e44af4 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/application/components/services/DefaultInjectionService.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/application/components/services/DefaultInjectionService.scala @@ -26,7 +26,7 @@ class DefaultInjectionService extends InjectionService { Future.Unit } - override def profileUpdated(displayName: Option[String], + override def profileUpdated(displayName: String, web: Option[String], birthday: Option[Long], location: Option[String], diff --git a/core/src/main/scala/io/github/cactacea/backend/core/application/services/AccountsService.scala b/core/src/main/scala/io/github/cactacea/backend/core/application/services/AccountsService.scala index 62f3bbef..b8e9426b 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/application/services/AccountsService.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/application/services/AccountsService.scala @@ -51,7 +51,7 @@ class AccountsService @Inject()( } } - def update(displayName: Option[String], + def update(displayName: String, web: Option[String], birthday: Option[Long], location: Option[String], diff --git a/core/src/main/scala/io/github/cactacea/backend/core/domain/models/Account.scala b/core/src/main/scala/io/github/cactacea/backend/core/domain/models/Account.scala index 922011a3..b9da54c2 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/domain/models/Account.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/domain/models/Account.scala @@ -5,7 +5,7 @@ import io.github.cactacea.backend.core.infrastructure.models._ case class Account(id: AccountId, accountName: String, - displayName: Option[String], + displayName: String, profileImageUrl: Option[String], friend: Boolean, friendRequestInProgress: Boolean, @@ -70,7 +70,7 @@ object Account { Account( a.id, a.accountName, - r.map(_.displayName).getOrElse(a.displayName), + r.flatMap(_.displayName).getOrElse(a.displayName), a.profileImageUrl, r.map(_.friend).getOrElse(false), r.map(_.inProgress).getOrElse(false), diff --git a/core/src/main/scala/io/github/cactacea/backend/core/domain/repositories/AccountsRepository.scala b/core/src/main/scala/io/github/cactacea/backend/core/domain/repositories/AccountsRepository.scala index 0543ad21..ceff0434 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/domain/repositories/AccountsRepository.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/domain/repositories/AccountsRepository.scala @@ -75,7 +75,7 @@ class AccountsRepository @Inject()( accountsDAO.updatePassword(oldPassword, newPassword, sessionId) } - def updateProfile(displayName: Option[String], + def updateProfile(displayName: String, web: Option[String], birthday: Option[Long], location: Option[String], diff --git a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/AccountsDAO.scala b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/AccountsDAO.scala index c620a0a4..84f1990f 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/AccountsDAO.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/AccountsDAO.scala @@ -23,13 +23,12 @@ class AccountsDAO @Inject()( def create(accountName: String, password: String): Future[AccountId] = { - val displayName: Option[String] = Some(accountName) val accountStatus = AccountStatusType.normally val hashedPassword = hashService.hash(password) val q = quote { query[Accounts].insert( _.accountName -> lift(accountName), - _.displayName -> lift(displayName), + _.displayName -> lift(accountName), _.password -> lift(hashedPassword), _.accountStatus -> lift(accountStatus) ).returning(_.id) @@ -38,7 +37,7 @@ class AccountsDAO @Inject()( } - def updateProfile(displayName: Option[String], + def updateProfile(displayName: String, web: Option[String], birthday: Option[Long], location: Option[String], @@ -194,13 +193,13 @@ class AccountsDAO @Inject()( (for { accounts <- run(q) - ids = accounts.map({ case (a, r) => a.id}) + ids = accounts.map({ case (a, _) => a.id}) blocksCount <- blocksCountDAO.findRelationshipBlocks(ids, sessionId) } yield (accounts, blocksCount)) .map({ case (accounts, blocksCount) => accounts.map({ case (a, r) => val b = blocksCount.find(_.id == a.id).getOrElse(RelationshipBlocksCount(a.id, 0L, 0L, 0L)) - val displayName = r.map(_.displayName).getOrElse(a.displayName) + val displayName = r.flatMap(_.displayName).getOrElse(a.displayName) val friendCount = a.friendCount - b.friendCount val followCount = a.followCount - b.followCount val followerCount = a.followerCount - b.followerCount @@ -233,7 +232,7 @@ class AccountsDAO @Inject()( val q2 = quote { query[Accounts] .filter({a => a.id != lift(by)}) - .filter(a => (a.accountName like lift(un)) || a.displayName.exists(_ like lift(un)) || (lift(un) == "")) + .filter(a => (a.accountName like lift(un)) || (a.displayName like lift(un)) || (lift(un) == "")) .filter(a => a.accountStatus == lift(status)) .filter(a => a.id < lift(s) || lift(s) == -1L) .filter(a => query[Blocks].filter(b => b.accountId == lift(by) && b.by == a.id).isEmpty) @@ -246,7 +245,7 @@ class AccountsDAO @Inject()( (for { accounts <- run(q2) - ids = accounts.map({ case (a, r) => a.id}) + ids = accounts.map({ case (a, _) => a.id}) blocksCount <- blocksCountDAO.findRelationshipBlocks(ids, sessionId) } yield (accounts, blocksCount)) .map({ case (accounts, blocksCount) => @@ -255,7 +254,7 @@ class AccountsDAO @Inject()( val friendCount = a.friendCount - b.map(_.friendCount).getOrElse(0L) val followCount = a.followCount - b.map(_.followCount).getOrElse(0L) val followerCount = a.followerCount - b.map(_.followerCount).getOrElse(0L) - val displayName = r.map(_.displayName).getOrElse(a.displayName) + val displayName = r.flatMap(_.displayName).getOrElse(a.displayName) val na = a.copy( displayName = displayName, friendCount = friendCount, diff --git a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/PushNotificationsDAO.scala b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/PushNotificationsDAO.scala index 4cbd9e0e..d2c814e9 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/PushNotificationsDAO.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/dao/PushNotificationsDAO.scala @@ -29,11 +29,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { || (f.by == af.accountId))}) .join(query[Accounts]).on({ case (((af, _), _), a) => a.id == af.by}) .join(query[Devices]).on({ case ((((af, _), _), _), d) => d.accountId == af.accountId && d.pushToken.isDefined}) - .map({case ((((af, r), _), a), d) => (a.accountName, a.displayName, r.map(_.displayName), af.accountId, d.pushToken) }) + .map({case ((((af, r), _), a), d) => (a.displayName, r.flatMap(_.displayName), af.accountId, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showContent = false) }})) @@ -47,11 +47,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { .leftJoin(query[Relationships]).on((g, r) => r.accountId == g.by && r.by == g.accountId) .join(query[Accounts]).on({ case ((g, _), a) => a.id == g.by}) .join(query[Devices]).on({ case (((g, _), _), d) => d.accountId == g.accountId && d.pushToken.isDefined}) - .map({ case (((g, r), a), d) => (a.accountName, a.displayName, r.map(_.displayName), g.accountId, d.pushToken) }) + .map({ case (((g, r), a), d) => (a.displayName, r.flatMap(_.displayName), g.accountId, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showContent = false) }})) @@ -64,11 +64,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { .leftJoin(query[Relationships]).on((g, r) => r.accountId == g.by && r.by == g.accountId) .join(query[Accounts]).on({ case ((g, _), a) => a.id == g.by}) .join(query[Devices]).on({ case (((g, _), _), d) => d.accountId == g.accountId && d.pushToken.isDefined}) - .map({ case (((g, r), a), d) => (a.accountName, a.displayName, r.map(_.displayName), g.accountId, d.pushToken) }) + .map({ case (((g, r), a), d) => (a.displayName, r.flatMap(_.displayName), g.accountId, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showContent = false) }})) @@ -85,11 +85,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { .leftJoin(query[Relationships]).on({ case (((am, _), _), r) => r.accountId == am.by && r.by == am.accountId }) .join(query[Accounts]).on({ case ((((am, _), _), _), a) => a.id == am.by}) .join(query[Devices]).on({ case (((((am, _), _), _), _), d) => d.accountId == am.accountId && d.pushToken.isDefined}) - .map({case (((((am, _), p), r), a), d) => (a.accountName, a.displayName, r.map(_.displayName), p.showMessage, am.accountId, d.pushToken) }) + .map({case (((((am, _), p), r), a), d) => (a.displayName, r.flatMap(_.displayName), p.showMessage, am.accountId, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, showMessage, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, showMessage, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showMessage) }})) @@ -108,11 +108,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { .leftJoin(query[Relationships]).on({ case ((c, f), r) => r.accountId == c.by && r.by == f.by}) .join(query[Accounts]).on({ case (((c, _), _), a) => a.id == c.by}) .join(query[Devices]).on({ case ((((_, f), _), _), d) => d.accountId == f.by && d.pushToken.isDefined}) - .map({case ((((_, f), r), a), d) => (a.accountName, a.displayName, r.map(_.displayName), f.by, d.pushToken) }) + .map({case ((((_, f), r), a), d) => (a.displayName, r.flatMap(_.displayName), f.by, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showContent = false) }})) @@ -127,11 +127,11 @@ class PushNotificationsDAO @Inject()(db: DatabaseService) { .leftJoin(query[Relationships]).on({ case ((c, f), r) => r.accountId == c.by && r.by == f.by}) .join(query[Accounts]).on({ case (((c, _), _), a) => a.id == c.by}) .join(query[Devices]).on({ case ((((_, f), _), _), d) => d.accountId == f.by && d.pushToken.isDefined}) - .map({case ((((_, f), r), a), d) => (a.accountName, a.displayName, r.map(_.displayName), f.by, d.pushToken) }) + .map({case ((((_, f), r), a), d) => (a.displayName, r.flatMap(_.displayName), f.by, d.pushToken) }) .distinct } - run(q).map(_.map({ case (accountName, displayName, editedDisplayName, accountId, pushToken) => { - val name = editedDisplayName.getOrElse(displayName).getOrElse(accountName) + run(q).map(_.map({ case (displayName, editedDisplayName, accountId, pushToken) => { + val name = editedDisplayName.getOrElse(displayName) val token = pushToken.get PushNotifications(accountId, name, token, showContent = false) }})) diff --git a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/models/Accounts.scala b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/models/Accounts.scala index f0123aa6..b620eb6c 100644 --- a/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/models/Accounts.scala +++ b/core/src/main/scala/io/github/cactacea/backend/core/infrastructure/models/Accounts.scala @@ -6,7 +6,7 @@ import io.github.cactacea.backend.core.infrastructure.identifiers.{AccountId, Me case class Accounts( id: AccountId, accountName: String, - displayName: Option[String], + displayName: String, profileImage: Option[MediumId], profileImageUrl: Option[String], password: String, diff --git a/core/src/test/scala/io/github/cactacea/core/domain/repositories/AccountsRepositorySpec.scala b/core/src/test/scala/io/github/cactacea/core/domain/repositories/AccountsRepositorySpec.scala index 1540f5ba..bca43018 100644 --- a/core/src/test/scala/io/github/cactacea/core/domain/repositories/AccountsRepositorySpec.scala +++ b/core/src/test/scala/io/github/cactacea/core/domain/repositories/AccountsRepositorySpec.scala @@ -125,7 +125,7 @@ class AccountsRepositorySpec extends RepositorySpec { execute(accountsRepository.updateDisplayName(account.id, Some("new account name"), session.id.toSessionId)) val result = execute(accountsRepository.find(account.id, session.id.toSessionId)) assert(result.id == account.id) - assert(result.displayName == Some("new account name")) + assert(result.displayName == "new account name") } diff --git a/core/src/test/scala/io/github/cactacea/core/domain/repositories/SessionsRepositorySpec.scala b/core/src/test/scala/io/github/cactacea/core/domain/repositories/SessionsRepositorySpec.scala index 9b15abc6..c603ded2 100644 --- a/core/src/test/scala/io/github/cactacea/core/domain/repositories/SessionsRepositorySpec.scala +++ b/core/src/test/scala/io/github/cactacea/core/domain/repositories/SessionsRepositorySpec.scala @@ -19,7 +19,7 @@ class SessionsRepositorySpec extends RepositorySpec { test("signUp") { val accountName = "SessionsRepositorySpec1" - val displayName = Some("SessionsRepositorySpec1") + val displayName = "SessionsRepositorySpec1" val password = "password" val udid = "0123456789012345678901234567890123456789" val userAgent = Some("userAgent") @@ -46,7 +46,7 @@ class SessionsRepositorySpec extends RepositorySpec { test("signIn") { val accountName = "SessionsRepositorySpec2" - val displayName = Some("SessionsRepositorySpec2") + val displayName = "SessionsRepositorySpec2" val password = "password" val udid = "0123456789012345678901234567890123456789" val userAgent = Some("userAgent") @@ -60,7 +60,6 @@ class SessionsRepositorySpec extends RepositorySpec { test("invalid password signIn ") { val accountName = "SessionsRepositorySpec3" - val displayName = Some("SessionsRepositorySpec3") val password = "password" val udid = "0123456789012345678901234567890123456789" val userAgent = Some("userAgent") @@ -75,7 +74,6 @@ class SessionsRepositorySpec extends RepositorySpec { test("signOut") { val accountName = "SessionsRepositorySpec4" - val displayName = Some("SessionsRepositorySpec4") val password = "password" val udid = "0123456789012345678901234567890123456789" val userAgent = Some("userAgent") @@ -87,7 +85,6 @@ class SessionsRepositorySpec extends RepositorySpec { test("checkAccountStatus") { val accountName = "SessionsRepositorySpec5" - val displayName = Some("SessionsRepositorySpec5") val password = "password" val udid = "0123456789012345678901234567890123456789" val userAgent = Some("userAgent") diff --git a/core/src/test/scala/io/github/cactacea/core/helpers/FactoryHelper.scala b/core/src/test/scala/io/github/cactacea/core/helpers/FactoryHelper.scala index 67ec96b9..e23cb509 100644 --- a/core/src/test/scala/io/github/cactacea/core/helpers/FactoryHelper.scala +++ b/core/src/test/scala/io/github/cactacea/core/helpers/FactoryHelper.scala @@ -28,7 +28,7 @@ object FactoryHelper { profileImage = None, profileImageUrl = None, accountName = accountName, - displayName = Some(accountName), + displayName = accountName, password = "password", accountStatus = AccountStatusType.normally, followCount = 0L, diff --git a/core/src/test/scala/io/github/cactacea/core/helpers/ServiceSpec.scala b/core/src/test/scala/io/github/cactacea/core/helpers/ServiceSpec.scala index 8d813f82..b3304ad3 100644 --- a/core/src/test/scala/io/github/cactacea/core/helpers/ServiceSpec.scala +++ b/core/src/test/scala/io/github/cactacea/core/helpers/ServiceSpec.scala @@ -39,7 +39,7 @@ class ServiceSpec extends IntegrationTest with BeforeAndAfter with Logging { val timeService = injector.instance[TimeService] def signUp(accountName: String, password: String, udid: String) = { - execute(sessionService.signUp(accountName, password, "ffc1ded6f4570d557ad65f986684fc10c7f8d51f", Some("user-agent"), DeviceType.ios)) + execute(sessionService.signUp(accountName, password, udid, Some("user-agent"), DeviceType.ios)) } diff --git a/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/AccountsDAOSpec.scala b/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/AccountsDAOSpec.scala index 0c384ef9..9bccf323 100644 --- a/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/AccountsDAOSpec.scala +++ b/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/AccountsDAOSpec.scala @@ -114,17 +114,17 @@ class AccountsDAOSpec extends DAOSpec with Logging { execute(accountsDAO.updateDisplayName(account2.id, Some("newUserName2"), sessionAccount.id.toSessionId)) val result1 = execute(accountsDAO.find(account1.id, sessionAccount.id.toSessionId)) - assert(result1.get._1.displayName == Some("newUserName1")) + assert(result1.get._1.displayName == "newUserName1") val result2 = execute(accountsDAO.find(account2.id, sessionAccount.id.toSessionId)) - assert(result2.get._1.displayName == Some("newUserName2")) + assert(result2.get._1.displayName == "newUserName2") execute(accountsDAO.updateDisplayName(account1.id, None, sessionAccount.id.toSessionId)) execute(accountsDAO.updateDisplayName(account2.id, None, sessionAccount.id.toSessionId)) val result3 = execute(accountsDAO.find(account1.id, sessionAccount.id.toSessionId)) - assert(result3.get._1.displayName == None) + assert(result3.get._1.displayName == "AccountsDAOSpec12") val result4 = execute(accountsDAO.find(account2.id, sessionAccount.id.toSessionId)) - assert(result4.get._1.displayName == None) + assert(result4.get._1.displayName == "AccountsDAOSpec13") } diff --git a/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/CommentsDAOSpec.scala b/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/CommentsDAOSpec.scala index a1c24a9a..a4fb6d8c 100644 --- a/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/CommentsDAOSpec.scala +++ b/core/src/test/scala/io/github/cactacea/core/infrastructure/dao/CommentsDAOSpec.scala @@ -92,7 +92,7 @@ class CommentsDAOSpec extends DAOSpec { val feedId = execute(feedsDAO.create("message", None, None, FeedPrivacyType.everyone, false, None, sessionAccount1.id.toSessionId)) val commentId1 = execute(commentsDAO.create(feedId, "1" * 100, sessionAccount2.id.toSessionId)) - val commentId2 = execute(commentsDAO.create(feedId, "2" * 100, sessionAccount1.id.toSessionId)) + execute(commentsDAO.create(feedId, "2" * 100, sessionAccount1.id.toSessionId)) val exist1 = execute(commentsDAO.exist(commentId1, sessionAccount1.id.toSessionId)) val exist2 = execute(commentsDAO.exist(commentId1, sessionAccount1.id.toSessionId)) diff --git a/server/src/main/scala/io/github/cactacea/backend/models/requests/session/PutSessionProfile.scala b/server/src/main/scala/io/github/cactacea/backend/models/requests/session/PutSessionProfile.scala index b991489a..a04cea2a 100644 --- a/server/src/main/scala/io/github/cactacea/backend/models/requests/session/PutSessionProfile.scala +++ b/server/src/main/scala/io/github/cactacea/backend/models/requests/session/PutSessionProfile.scala @@ -5,7 +5,7 @@ import io.swagger.annotations.ApiModelProperty case class PutSessionProfile ( @ApiModelProperty(value = "Display name.", required = true) - @Size(min = 1, max = 50) displayName: Option[String], + @Size(min = 1, max = 50) displayName: String, @ApiModelProperty(value = "Profile URL.", required = true) @Size(min = 0, max = 2038) web: Option[String],