Skip to content

Commit

Permalink
TRELLO-2537 : fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
ssedoudbgouv committed Sep 26, 2024
1 parent 4731f69 commit 13af19b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 17 deletions.
4 changes: 2 additions & 2 deletions app/controllers/AccountController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class AccountController(
}

def fetchPendingAgent(role: Option[UserRole]) =
SecuredAction.andThen(WithRole(UserRole.AdminsAndReadOnly)).async { request =>
SecuredAction.andThen(WithRole(UserRole.AdminsAndReadOnly)).async { _ =>
role match {
case Some(UserRole.DGCCRF) | Some(UserRole.DGAL) | None =>
accessesOrchestrator
.listAgentPendingTokens(request.identity, role)
.listAgentPendingTokens(role)
.map(tokens => Ok(Json.toJson(tokens)))
case Some(role) => Future.failed(error.AppError.WrongUserRole(role))
}
Expand Down
10 changes: 1 addition & 9 deletions app/models/report/sampledata/ReportGenerator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ object ReportGenerator {
influencer: Option[Influencer],
consumerUser: ConsumerUser,
tags: List[ReportTag],
expired: Boolean,
french: Boolean
): ReportDraft =
ReportDraft(
Expand Down Expand Up @@ -111,7 +110,7 @@ object ReportGenerator {
)
}

def visibleReports(company: Company, expired: Boolean) =
def visibleReports(company: Company) =
ReportTag.values.collect {
case ReportTag.LitigeContractuel =>
generateReport(
Expand All @@ -122,7 +121,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(ReportTag.LitigeContractuel),
expired = expired,
french = true
)
case tag @ ReportTag.ProduitDangereux =>
Expand All @@ -134,7 +132,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)
case tag @ ReportTag.DemarchageTelephonique =>
Expand All @@ -146,7 +143,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)
case tag @ ReportTag.Influenceur =>
Expand All @@ -158,7 +154,6 @@ object ReportGenerator {
influencer = Some(Influencer(Some(TikTok), None, "InfluencerPseudo")),
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)
case tag @ ReportTag.ReponseConso =>
Expand All @@ -170,7 +165,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)
case tag @ ReportTag.Internet =>
Expand All @@ -182,7 +176,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)

Expand All @@ -195,7 +188,6 @@ object ReportGenerator {
influencer = None,
consumerUser = generateConsumerUser,
tags = List(tag),
expired = expired,
french = true
)
}.toList
Expand Down
8 changes: 4 additions & 4 deletions app/models/report/sampledata/SampleDataService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ class SampleDataService(
for {
_ <- companyRepository.create(c)
_ <- proUsers.traverse(accessTokenRepository.giveCompanyAccess(c, _, AccessLevel.ADMIN))
reports = ReportGenerator.visibleReports(c, expired = false)
reports = ReportGenerator.visibleReports(c)
createdReports <- reports.traverse(reportOrchestrator.createReport)
_ <- createdReports.traverse { r =>
val creationDate = OffsetDateTime.now().minusDays(Random.between(1, 20))
val creationDate = OffsetDateTime.now().minusDays(Random.between(1L, 20L))
reportRepository.update(
r.id,
r.copy(
Expand Down Expand Up @@ -167,10 +167,10 @@ class SampleDataService(
)

private def processedReports(c: Company, response: IncomingReportResponse, proUser: User) = for {
createdReports <- ReportGenerator.visibleReports(c, expired = false).traverse(reportOrchestrator.createReport)
createdReports <- ReportGenerator.visibleReports(c).traverse(reportOrchestrator.createReport)

updateReports <- createdReports.traverse { r =>
val creationDate = OffsetDateTime.now().minusWeeks(Random.between(1, 101))
val creationDate = OffsetDateTime.now().minusWeeks(Random.between(1L, 101L))
reportRepository.update(
r.id,
r.copy(
Expand Down
2 changes: 1 addition & 1 deletion app/orchestrators/AccessesOrchestrator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class AccessesOrchestrator(
} yield ()
}

def listAgentPendingTokens(user: User, maybeRequestedRole: Option[UserRole]): Future[List[AgentAccessToken]] =
def listAgentPendingTokens(maybeRequestedRole: Option[UserRole]): Future[List[AgentAccessToken]] =
accessTokenRepository.fetchPendingAgentTokens
.map(
_.flatMap { token =>
Expand Down
4 changes: 3 additions & 1 deletion test/tasks/report/ReportRemindersTaskUnitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.apache.pekko.actor.testkit.typed.scaladsl.ActorTestKit
import config.ExportReportsToSFTPConfiguration
import config.ProbeConfiguration
import config.ReportRemindersTaskConfiguration
import config.SampleDataConfiguration
import config.TaskConfiguration
import models.company.AccessLevel
import models.event.Event
Expand Down Expand Up @@ -56,7 +57,8 @@ class ReportRemindersTaskUnitSpec extends Specification with FutureMatchers {
inactiveAccounts = null,
companyUpdate = null,
probe = ProbeConfiguration(false),
exportReportsToSFTP = ExportReportsToSFTPConfiguration("./reports.csv", LocalTime.of(3, 30))
exportReportsToSFTP = ExportReportsToSFTPConfiguration("./reports.csv", LocalTime.of(3, 30)),
sampleData = SampleDataConfiguration(true, LocalTime.of(3, 30))
)

val testKit = ActorTestKit()
Expand Down

0 comments on commit 13af19b

Please sign in to comment.