Skip to content

Commit

Permalink
TRELLO-2364 filter out deprecated events
Browse files Browse the repository at this point in the history
  • Loading branch information
eletallbetagouv committed Aug 28, 2024
1 parent d749196 commit 153d496
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/repositories/event/EventRepository.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ class EventRepository(
extends CRUDRepository[EventTable, Event]
with EventRepositoryInterface {

override val table: TableQuery[EventTable] = EventTable.table
override val table = EventTable.table
import EventTable.fullTableIncludingDeprecated

val dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd")

import dbConfig._

override def create(element: Event): Future[Event] = db
.run(
fullTableIncludingDeprecated returning fullTableIncludingDeprecated += element
)

override def deleteByReportId(uuidReport: UUID): Future[Int] = db
.run(
table
Expand Down
7 changes: 6 additions & 1 deletion app/repositories/event/EventTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import utils.Constants
import java.time.OffsetDateTime
import java.util.UUID
import repositories.PostgresProfile.api._
import utils.Constants.ActionEvent.ACTIVATION_DOC_RETURNED

class EventTable(tag: Tag) extends DatabaseTable[Event](tag, "events") {

Expand Down Expand Up @@ -45,5 +46,9 @@ class EventTable(tag: Tag) extends DatabaseTable[Event](tag, "events") {
}

object EventTable {
val table = TableQuery[EventTable]
val fullTableIncludingDeprecated = TableQuery[EventTable]

val table: Query[EventTable, EventTable#TableElementType, Seq] = fullTableIncludingDeprecated
// These events are from an old feature
.filter(_.action =!= ACTIVATION_DOC_RETURNED.value)
}

0 comments on commit 153d496

Please sign in to comment.