Skip to content

Tech: Refacto de l'objet LegacyControlUnit et LegacyControlResources - #2973

Open
maximeperraultdev wants to merge 3 commits into
mainfrom
maxime/tech/legacy_control_unit
Open

Tech: Refacto de l'objet LegacyControlUnit et LegacyControlResources#2973
maximeperraultdev wants to merge 3 commits into
mainfrom
maxime/tech/legacy_control_unit

Conversation

@maximeperraultdev

@maximeperraultdev maximeperraultdev commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator
  • Remove Entity from Output and Input Data.
  • Keep legacy for legacy endpoint
  • Use ControlUnitEntity and ControlUnitResourceEntity instead of legacy

@maximeperraultdev maximeperraultdev added the tech. enhancement technical enhancement label Jun 17, 2026
@tristanrobert

tristanrobert commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@maximeperraultdev
maximeperraultdev force-pushed the maxime/tech/legacy_control_unit branch from 8437660 to 5680ec9 Compare June 17, 2026 16:33
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@maximeperraultdev
maximeperraultdev force-pushed the maxime/tech/legacy_control_unit branch 5 times, most recently from 8ae3aa4 to deca74b Compare July 21, 2026 07:01
@maximeperraultdev
maximeperraultdev force-pushed the maxime/tech/legacy_control_unit branch 2 times, most recently from cf0bdce to 0de958e Compare July 21, 2026 15:22
package fr.gouv.cacem.monitorenv.domain.entities.controlUnit

// TODO Replace this entity with `ControlUnitEntity`. It's left for `MissionEntity.units` backward compatibility.
data class LegacyControlUnitEntity(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il ne faut pas supprimer cette Entité?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non elle sert encore pour les endpoint qui l'utilisait. J'ai uniquement séparé en 3 data class.
Legac

isArchived = false,
note = null,
photo = null,
// TODO: ???

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a supprimer?

note = null,
photo = null,
// TODO: ???
stationId = 1,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi stationId = 1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

houla oups.

controlUnits = dto.mission.controlUnits,
controlUnits =
dto.mission.controlUnits.map {
LegacyControlUnitDataOutput.fromControlUnit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi LegacyControlUnitDataOutput ?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on laisse les legacyDataOutput et Input. Avant on avait des legacyControlUnitEntity. Ce qui posait des soucis pour les consommateurs de nos apis si on changeait l'entité.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mais j'avoue que je pourrais les nommer autrement car il n'y en a pas d'autres...

controlUnits = mission.controlUnits,
controlUnits =
mission.controlUnits.map {
LegacyControlUnitDataOutput.fromControlUnit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi LegacyControlUnitDataOutput ?

controlUnits = dto.mission.controlUnits,
controlUnits =
dto.mission.controlUnits.map {
LegacyControlUnitDataOutput.fromControlUnit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

même question

controlUnits = mission.controlUnits,
controlUnits =
mission.controlUnits.map {
LegacyControlUnitDataOutput.fromControlUnit(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem


import type { ControlTheme } from '../domain/entities/controlThemes'

export const controlThemesAPI = monitorenvPrivateApi.injectEndpoints({

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bah c'était quoi ce fichier  ???

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

un reliquat du passé je dirais.

@maximeperraultdev
maximeperraultdev force-pushed the maxime/tech/legacy_control_unit branch from 0de958e to 45811a5 Compare July 30, 2026 15:07
@maximeperraultdev
maximeperraultdev force-pushed the maxime/tech/legacy_control_unit branch from ab7d396 to 2b8a506 Compare July 30, 2026 15:31
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tech. enhancement technical enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants