-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1940 from MTES-MCT/feature/1668-handle-file-new-form
[Back] Traitement des fichiers lors de la soumission d'un signalement
- Loading branch information
Showing
13 changed files
with
305 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DoctrineMigrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
final class Version20231114155429 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return 'Add new fields (document type and desordre slug)'; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE file ADD document_type VARCHAR(255) DEFAULT NULL'); | ||
$this->addSql('ALTER TABLE file ADD desordre_slug VARCHAR(255) DEFAULT NULL'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
$this->addSql('ALTER TABLE file DROP document_type'); | ||
$this->addSql('ALTER TABLE file DROP desordre_slug'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace App\Entity\Enum; | ||
|
||
enum DocumentType: String | ||
{ | ||
case SITUATION_FOYER_BAIL = 'SITUATION_FOYER_BAIL'; | ||
case SITUATION_FOYER_DPE = 'SITUATION_FOYER_DPE'; | ||
case SITUATION_FOYER_ETAT_DES_LIEUX = 'SITUATION_FOYER_ETAT_DES_LIEUX'; | ||
case SITUATION_DIAGNOSTIC_PLOMB_AMIANTE = 'SITUATION_DIAGNOSTIC_PLOMB_AMIANTE'; | ||
case PROCEDURE_MISE_EN_DEMEURE = 'PROCEDURE_MISE_EN_DEMEURE'; | ||
case PROCEDURE_RAPPORT_DE_VISITE = 'PROCEDURE_RAPPORT_DE_VISITE'; | ||
case PROCEDURE_ARRETE_MUNICIPAL = 'PROCEDURE_ARRETE_MUNICIPAL'; | ||
case PROCEDURE_ARRETE_PREFECTORAL = 'PROCEDURE_ARRETE_PREFECTORAL'; | ||
case PROCEDURE_SAISINE = 'PROCEDURE_SAISINE'; | ||
case BAILLEUR_DEVIS_POUR_TRAVAUX = 'BAILLEUR_DEVIS_POUR_TRAVAUX'; | ||
case BAILLEUR_REPONSE_BAILLEUR = 'BAILLEUR_REPONSE_BAILLEUR'; | ||
case AUTRE = 'AUTRE'; | ||
case SITUATION = 'SITUATION'; | ||
case VISITE = 'VISITE'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace App\Service\Signalement; | ||
|
||
use App\Entity\Enum\DocumentType; | ||
|
||
class SignalementDocumentTypeMapper | ||
{ | ||
public static function map(string $value): DocumentType | ||
{ | ||
if (str_starts_with($value, 'desordres_')) { | ||
return DocumentType::SITUATION; | ||
} | ||
|
||
if (str_contains($value, 'dpe_bail')) { | ||
return DocumentType::SITUATION_FOYER_BAIL; | ||
} | ||
|
||
if (str_contains($value, 'dpe_dpe')) { | ||
return DocumentType::SITUATION_FOYER_DPE; | ||
} | ||
|
||
return DocumentType::AUTRE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.