1 /* 2 * Make.org Core API 3 * Copyright (C) 2018 Make.org 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation, either version 3 of the 8 * License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Affero General Public License for more details. 14 * 15 * You should have received a copy of the GNU Affero General Public License 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 * 18 */ 19 20 package org.make.api.tag 21 22 import org.make.core.proposal.indexed.IndexedTag 23 import org.make.core.question.{Question, QuestionId} 24 import org.make.core.tag._ 25 import org.make.core.{Order, RequestContext} 26 27 import scala.concurrent.Future 28 import org.make.core.technical.Pagination._ 29 30 trait TagServiceComponent { 31 def tagService: TagService 32 } 33 34 final case class TagFilter( 35 tagIds: Option[Seq[TagId]] = None, 36 label: Option[String] = None, 37 tagTypeId: Option[TagTypeId] = None, 38 questionIds: Option[Seq[QuestionId]] = None 39 ) 40 41 object TagFilter { 42 val empty: TagFilter = TagFilter() 43 } 44 45 trait TagService { 46 def getTag(tagId: TagId): Future[Option[Tag]] 47 def createTag( 48 label: String, 49 tagTypeId: TagTypeId, 50 question: Question, 51 display: TagDisplay = TagDisplay.Inherit, 52 weight: Float = 0f 53 ): Future[Tag] 54 def findAll(): Future[Seq[Tag]] 55 def findAllDisplayed(): Future[Seq[Tag]] 56 def findByTagIds(tagIds: Seq[TagId]): Future[Seq[Tag]] 57 def findByQuestionId(questionId: QuestionId): Future[Seq[Tag]] 58 def findByLabel(partialLabel: String, like: Boolean): Future[Seq[Tag]] 59 def updateTag( 60 tagId: TagId, 61 label: String, 62 display: TagDisplay, 63 tagTypeId: TagTypeId, 64 weight: Float, 65 question: Question, 66 requestContext: RequestContext = RequestContext.empty 67 ): Future[Option[Tag]] 68 def retrieveIndexedTags(tags: Seq[Tag], tagTypes: Seq[TagType]): Seq[IndexedTag] 69 def find( 70 offset: Offset = Offset.zero, 71 end: Option[End] = None, 72 sort: Option[String] = None, 73 order: Option[Order] = None, 74 onlyDisplayed: Boolean = false, 75 tagFilter: TagFilter = TagFilter.empty 76 ): Future[Seq[Tag]] 77 def count(tagFilter: TagFilter = TagFilter.empty): Future[Int] 78 }
| Line | Stmt Id | Pos | Tree | Symbol | Tests | Code |
|---|---|---|---|---|---|---|
| 42 | 30166 | 1311 - 1322 | Apply | org.make.api.tag.TagFilter.apply | org.make.api.operation.operationofquestionservicetest,org.make.api.tag.tagapitest | TagFilter.apply(TagFilter.apply$default$1, TagFilter.apply$default$2, TagFilter.apply$default$3, TagFilter.apply$default$4) |
| 42 | 30033 | 1311 - 1311 | Select | org.make.api.tag.TagFilter.apply$default$2 | org.make.api.operation.operationofquestionservicetest,org.make.api.tag.tagapitest | TagFilter.apply$default$2 |
| 42 | 28726 | 1311 - 1311 | Select | org.make.api.tag.TagFilter.apply$default$4 | org.make.api.operation.operationofquestionservicetest,org.make.api.tag.tagapitest | TagFilter.apply$default$4 |
| 42 | 29207 | 1311 - 1311 | Select | org.make.api.tag.TagFilter.apply$default$3 | org.make.api.operation.operationofquestionservicetest,org.make.api.tag.tagapitest | TagFilter.apply$default$3 |
| 42 | 28564 | 1311 - 1311 | Select | org.make.api.tag.TagFilter.apply$default$1 | org.make.api.operation.operationofquestionservicetest,org.make.api.tag.tagapitest | TagFilter.apply$default$1 |