MTES-MCT / qualicharge

Améliorer la qualité globale du service de recharge pour véhicules électriques en analysant les données de supervision.
https://beta.gouv.fr/startups/qualicharge.html
MIT License
2 stars 1 forks source link

Orphan entries creation using the `/statique/{id_pdc_itinerance}` PUT endpoint (update) #40

Open jmaupetit opened 2 months ago

jmaupetit commented 2 months ago

Purpose

When updating a Statique entry, we manipulate multiple database tables. Some of those tables have no unicity criterion that allows us to update a PointDeCharge-related entry, but instead creates a new entry, leaving the former entry possibly orphan, i.e. not linked to any PointDeCharge.

Example: if we update the contact_amenageur field of a Statique entry, we will create a new entry for the Amenageur table and link this entry to the updated PointDeCharge. The original Amenageur entry won't be linked to this PointDeCharge, making it (possibly) orphan.

Proposal

Maybe we should be more granular and allow to update all statique-related entries (database tables) using a dedicated endpoint per object: PUT /statique/amenageur/{amenageur_id}.

An alternative - temporary - solution may be to clean orphan entries regularly to avoid database pollution.