Commit 45f4f077 authored by Tom Käsler's avatar Tom Käsler

add function for deleting all answers by questionid

parent 50fc590b
Pipeline #4941 passed with stage
in 1 minute and 14 seconds
......@@ -2,6 +2,7 @@ package services
import models._
import slick.driver.MySQLDriver.api._
import scala.concurrent.Future
object ChoiceAnswerService extends BaseService {
......@@ -23,4 +24,8 @@ object ChoiceAnswerService extends BaseService {
def delete(choiceAnswerId: ChoiceAnswerId): Future[Int] = {
choiceAnswersTable.filter(_.id === choiceAnswerId).delete
}
def deleteAllByQuestionId(questionId: QuestionId): Future[Int] = {
choiceAnswersTable.filter(_.questionId === questionId).delete
}
}
......@@ -25,4 +25,8 @@ object FreetextAnswerService extends BaseService {
def delete(freetextAnswerId: FreetextAnswerId): Future[Int] = {
freetextAnswersTable.filter(_.id === freetextAnswerId).delete
}
def deleteAllByQuestionId(questionId: QuestionId): Future[Int] = {
freetextAnswersTable.filter(_.questionId === questionId).delete
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment