diff --git a/src/main/scala/service/LabelsService.scala b/src/main/scala/service/LabelsService.scala index 83151ab..25f0938 100644 --- a/src/main/scala/service/LabelsService.scala +++ b/src/main/scala/service/LabelsService.scala @@ -2,23 +2,20 @@ import scala.slick.driver.H2Driver.simple._ import Database.threadLocalSession -import scala.slick.jdbc.{StaticQuery => Q} -import Q.interpolation import model._ -import Labels._ trait LabelsService { def getLabels(owner: String, repository: String): List[Label] = Query(Labels) - .filter(l => (l.userName is owner.bind) && (l.repositoryName is repository.bind)) + .filter(t => (t.userName is owner.bind) && (t.repositoryName is repository.bind)) .sortBy(_.labelName asc) .list def getLabel(owner: String, repository: String, labelId: Int): Option[Label] = Query(Labels) - .filter(l => (l.userName is owner.bind) && (l.repositoryName is repository.bind) && (l.labelId is labelId.bind)) + .filter(t => (t.userName is owner.bind) && (t.repositoryName is repository.bind) && (t.labelId is labelId.bind)) .firstOption def createLabel(owner: String, repository: String, labelName: String, color: String): Unit = @@ -26,19 +23,17 @@ def updateLabel(owner: String, repository: String, labelId: Int, labelName: String, color: String): Unit = Query(Labels) - .filter { l => (l.userName is owner.bind) && (l.repositoryName is repository.bind) && (l.labelId is labelId.bind)} - .map { l => l.labelName ~ l.color } + .filter { t => (t.userName is owner.bind) && (t.repositoryName is repository.bind) && (t.labelId is labelId.bind)} + .map { t => t.labelName ~ t.color } .update (labelName, color) def deleteLabel(owner: String, repository: String, labelId: Int): Unit = { - // TODO delete ISSUE_LABEL -// Query(Issues) -// .filter { i => (i.userName is owner.bind) && (i.repositoryName is repository.bind) && (i.milestoneId is milestoneId.bind)} -// .map { i => i.milestoneId.? } -// .update(None) + Query(IssueLabels) + .filter { t => (t.userName is owner.bind) && (t.repositoryName is repository.bind) && (t.labelId is labelId.bind)} + .delete Query(Labels) - .filter { i => (i.userName is owner.bind) && (i.repositoryName is repository.bind) && (i.labelId is labelId.bind)} + .filter { t => (t.userName is owner.bind) && (t.repositoryName is repository.bind) && (t.labelId is labelId.bind)} .delete }