diff --git a/src/main/scala/service/AccountService.scala b/src/main/scala/service/AccountService.scala index a811f80..816bbda 100644 --- a/src/main/scala/service/AccountService.scala +++ b/src/main/scala/service/AccountService.scala @@ -24,7 +24,7 @@ lastLoginDate = None) def updateAccount(account: Account): Unit = - Query(Accounts) + Accounts .filter { a => a.userName is account.userName.bind } .map { a => a.password ~ a.mailAddress ~ a.isAdmin ~ a.url.? ~ a.registeredDate ~ a.updatedDate ~ a.lastLoginDate.? } .update ( @@ -37,6 +37,6 @@ account.lastLoginDate) def updateLastLoginDate(userName: String): Unit = - Query(Accounts).filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate) + Accounts.filter(_.userName is userName.bind).map(_.lastLoginDate).update(currentDate) } diff --git a/src/main/scala/service/IssuesService.scala b/src/main/scala/service/IssuesService.scala index 778f24e..56903b1 100644 --- a/src/main/scala/service/IssuesService.scala +++ b/src/main/scala/service/IssuesService.scala @@ -74,7 +74,6 @@ .map { case (labelName, t) => labelName ~ t.length } - .list .toMap } diff --git a/src/main/scala/service/LabelsService.scala b/src/main/scala/service/LabelsService.scala index 6db0872..a84bbf6 100644 --- a/src/main/scala/service/LabelsService.scala +++ b/src/main/scala/service/LabelsService.scala @@ -17,12 +17,12 @@ Labels.ins insert (owner, repository, labelName, color) def updateLabel(owner: String, repository: String, labelId: Int, labelName: String, color: String): Unit = - Query(Labels).filter(_.byPrimaryKey(owner, repository, labelId)).map(t => t.labelName ~ t.color) + Labels.filter(_.byPrimaryKey(owner, repository, labelId)).map(t => t.labelName ~ t.color) .update(labelName, color) def deleteLabel(owner: String, repository: String, labelId: Int): Unit = { - Query(IssueLabels).filter(_.byLabel(owner, repository, labelId)).delete - Query(Labels).filter(_.byPrimaryKey(owner, repository, labelId)).delete + IssueLabels.filter(_.byLabel(owner, repository, labelId)).delete + Labels.filter(_.byPrimaryKey(owner, repository, labelId)).delete } } diff --git a/src/main/scala/service/MilestonesService.scala b/src/main/scala/service/MilestonesService.scala index 0bcf91a..5befbd9 100644 --- a/src/main/scala/service/MilestonesService.scala +++ b/src/main/scala/service/MilestonesService.scala @@ -13,7 +13,7 @@ Milestones.ins insert (owner, repository, title, description, dueDate, None) def updateMilestone(milestone: Milestone): Unit = - Query(Milestones) + Milestones .filter (t => t.byPrimaryKey(milestone.userName, milestone.repositoryName, milestone.milestoneId)) .map (t => t.title ~ t.description.? ~ t.dueDate.? ~ t.closedDate.?) .update (milestone.title, milestone.description, milestone.dueDate, milestone.closedDate) @@ -23,8 +23,8 @@ def closeMilestone(milestone: Milestone): Unit = updateMilestone(milestone.copy(closedDate = Some(currentDate))) def deleteMilestone(owner: String, repository: String, milestoneId: Int): Unit = { - Query(Issues).filter(_.byMilestone(owner, repository, milestoneId)).map(_.milestoneId.?).update(None) - Query(Milestones).filter(_.byPrimaryKey(owner, repository, milestoneId)).delete + Issues.filter(_.byMilestone(owner, repository, milestoneId)).map(_.milestoneId.?).update(None) + Milestones.filter(_.byPrimaryKey(owner, repository, milestoneId)).delete } def getMilestone(owner: String, repository: String, milestoneId: Int): Option[Milestone] = @@ -34,9 +34,7 @@ val counts = Issues .filter { t => (t.byRepository(owner, repository)) && (t.milestoneId isNotNull) } .groupBy { t => t.milestoneId ~ t.closed } - .map { case (t1, t2) => t1._1 ~ t1._2 ~ t2.length } - .list - .map { case (milestoneId, closed, count) => (milestoneId, closed) -> count } + .map { case (t1, t2) => (t1._1 ~ t1._2) -> t2.length } .toMap getMilestones(owner, repository).map { milestone => diff --git a/src/main/scala/service/RepositoryService.scala b/src/main/scala/service/RepositoryService.scala index 6a07c47..519e944 100644 --- a/src/main/scala/service/RepositoryService.scala +++ b/src/main/scala/service/RepositoryService.scala @@ -52,7 +52,7 @@ * @return the list of repository names */ def getRepositoryNamesOfUser(userName: String): List[String] = - Query(Repositories).filter(_.userName is userName.bind).list.map(_.repositoryName) + Query(Repositories) filter(_.userName is userName.bind) map (_.repositoryName) list /** * Returns the list of specified user's repositories information. @@ -141,14 +141,14 @@ * Updates the last activity date of the repository. */ def updateLastActivityDate(userName: String, repositoryName: String): Unit = - Query(Repositories).filter(_.byRepository(userName, repositoryName)).map(_.lastActivityDate).update(currentDate) + Repositories.filter(_.byRepository(userName, repositoryName)).map(_.lastActivityDate).update(currentDate) /** * Save repository options. */ def saveRepositoryOptions(userName: String, repositoryName: String, description: Option[String], defaultBranch: String, isPrivate: Boolean): Unit = - Query(Repositories).filter(_.byRepository(userName, repositoryName)) + Repositories.filter(_.byRepository(userName, repositoryName)) .map { r => r.description.? ~ r.defaultBranch ~ r.isPrivate ~ r.updatedDate } .update (description, defaultBranch, isPrivate, currentDate) @@ -170,9 +170,8 @@ * @param collaboratorName the collaborator name */ def removeCollaborator(userName: String, repositoryName: String, collaboratorName: String): Unit = - Query(Collaborators).filter(_.byPrimaryKey(userName, repositoryName, collaboratorName)).delete - - + Collaborators.filter(_.byPrimaryKey(userName, repositoryName, collaboratorName)).delete + /** * Returns the list of collaborators name which is sorted with ascending order. * @@ -181,7 +180,7 @@ * @return the list of collaborators name */ def getCollaborators(userName: String, repositoryName: String): List[String] = - Query(Collaborators).filter(_.byRepository(userName, repositoryName)).sortBy(_.collaboratorName).list.map(_.collaboratorName) + Query(Collaborators).filter(_.byRepository(userName, repositoryName)).sortBy(_.collaboratorName).map(_.collaboratorName).list def hasWritePermission(owner: String, repository: String, loginAccount: Option[Account]): Boolean = { loginAccount match {