From 6edb5eb5cfe62732414720cc38454eb39c02575c Mon Sep 17 00:00:00 2001 From: Olivier Ribiere Date: Wed, 6 Nov 2024 18:14:24 +0100 Subject: [PATCH 1/2] fix(data): Review validated fields for actors and projects --- symfony/migrations/Version20241105102005.php | 144 ------------------ symfony/migrations/Version20241106170537.php | 31 ++++ .../Processor/ActorProjectProcessor.php | 2 +- symfony/src/Entity/Actor.php | 26 +--- symfony/src/Entity/Project.php | 22 +-- symfony/src/Entity/Trait/ToValidateEntity.php | 27 ++++ ...cessor.php => ValidateEntityProcessor.php} | 2 +- .../State/Provider/ProjectProvider.php | 28 ++++ vue/src/stores/actorsStore.ts | 4 +- vue/src/stores/applicationStore.ts | 10 +- vue/src/stores/projectStore.ts | 4 +- vue/src/stores/userStore.ts | 5 + vue/src/views/actors/ActorsView.vue | 5 +- 13 files changed, 129 insertions(+), 181 deletions(-) delete mode 100644 symfony/migrations/Version20241105102005.php create mode 100644 symfony/migrations/Version20241106170537.php create mode 100644 symfony/src/Entity/Trait/ToValidateEntity.php rename symfony/src/Services/State/Processor/{ActorProcessor.php => ValidateEntityProcessor.php} (94%) create mode 100644 symfony/src/Services/State/Provider/ProjectProvider.php diff --git a/symfony/migrations/Version20241105102005.php b/symfony/migrations/Version20241105102005.php deleted file mode 100644 index 8048c74..0000000 --- a/symfony/migrations/Version20241105102005.php +++ /dev/null @@ -1,144 +0,0 @@ -addSql('CREATE SEQUENCE actor_expertise_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE administrative_scope_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE media_object_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE project_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE thematic_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1'); - $this->addSql('CREATE TABLE actor (id UUID NOT NULL, logo_id INT DEFAULT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, name VARCHAR(255) NOT NULL, acronym VARCHAR(255) NOT NULL, is_validated BOOLEAN NOT NULL, category VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, office_name VARCHAR(255) DEFAULT NULL, office_address VARCHAR(255) DEFAULT NULL, office_location geometry(POINT, 0) DEFAULT NULL, contact_name VARCHAR(255) DEFAULT NULL, contact_position VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, external_images TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, slug VARCHAR(128) DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_447556F9989D9B62 ON actor (slug)'); - $this->addSql('CREATE INDEX IDX_447556F9F98F144A ON actor (logo_id)'); - $this->addSql('CREATE INDEX IDX_447556F9DE12AB56 ON actor (created_by)'); - $this->addSql('CREATE INDEX IDX_447556F916FE72E1 ON actor (updated_by)'); - $this->addSql('COMMENT ON COLUMN actor.id IS \'(DC2Type:uuid)\''); - $this->addSql('COMMENT ON COLUMN actor.external_images IS \'(DC2Type:simple_array)\''); - $this->addSql('CREATE TABLE actor_actor_expertise (actor_id UUID NOT NULL, actor_expertise_id INT NOT NULL, PRIMARY KEY(actor_id, actor_expertise_id))'); - $this->addSql('CREATE INDEX IDX_4A438EAD10DAF24A ON actor_actor_expertise (actor_id)'); - $this->addSql('CREATE INDEX IDX_4A438EAD916905AC ON actor_actor_expertise (actor_expertise_id)'); - $this->addSql('COMMENT ON COLUMN actor_actor_expertise.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE actor_thematic (actor_id UUID NOT NULL, thematic_id INT NOT NULL, PRIMARY KEY(actor_id, thematic_id))'); - $this->addSql('CREATE INDEX IDX_D159A26410DAF24A ON actor_thematic (actor_id)'); - $this->addSql('CREATE INDEX IDX_D159A2642395FCED ON actor_thematic (thematic_id)'); - $this->addSql('COMMENT ON COLUMN actor_thematic.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE actor_administrative_scope (actor_id UUID NOT NULL, administrative_scope_id INT NOT NULL, PRIMARY KEY(actor_id, administrative_scope_id))'); - $this->addSql('CREATE INDEX IDX_65EBE3CC10DAF24A ON actor_administrative_scope (actor_id)'); - $this->addSql('CREATE INDEX IDX_65EBE3CCC1892E43 ON actor_administrative_scope (administrative_scope_id)'); - $this->addSql('COMMENT ON COLUMN actor_administrative_scope.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE actor_media_object (actor_id UUID NOT NULL, media_object_id INT NOT NULL, PRIMARY KEY(actor_id, media_object_id))'); - $this->addSql('CREATE INDEX IDX_18E6A66710DAF24A ON actor_media_object (actor_id)'); - $this->addSql('CREATE INDEX IDX_18E6A66764DE5A5 ON actor_media_object (media_object_id)'); - $this->addSql('COMMENT ON COLUMN actor_media_object.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE actor_expertise (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE administrative_scope (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE media_object (id INT NOT NULL, file_path VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE project (id INT NOT NULL, actor_id UUID NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, name VARCHAR(255) NOT NULL, location VARCHAR(255) NOT NULL, coords geometry(POINT, 0) NOT NULL, status VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, images JSON DEFAULT NULL, partners JSON DEFAULT NULL, intervention_zone VARCHAR(255) NOT NULL, project_manager_name VARCHAR(255) DEFAULT NULL, project_manager_position VARCHAR(255) DEFAULT NULL, project_manager_email VARCHAR(255) DEFAULT NULL, project_manager_tel VARCHAR(255) DEFAULT NULL, project_manager_photo VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, logo VARCHAR(255) DEFAULT NULL, deliverables TEXT DEFAULT NULL, calendar TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, slug VARCHAR(128) DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_2FB3D0EE989D9B62 ON project (slug)'); - $this->addSql('CREATE INDEX IDX_2FB3D0EE10DAF24A ON project (actor_id)'); - $this->addSql('CREATE INDEX IDX_2FB3D0EEDE12AB56 ON project (created_by)'); - $this->addSql('CREATE INDEX IDX_2FB3D0EE16FE72E1 ON project (updated_by)'); - $this->addSql('COMMENT ON COLUMN project.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE project_thematic (project_id INT NOT NULL, thematic_id INT NOT NULL, PRIMARY KEY(project_id, thematic_id))'); - $this->addSql('CREATE INDEX IDX_415254A9166D1F9C ON project_thematic (project_id)'); - $this->addSql('CREATE INDEX IDX_415254A92395FCED ON project_thematic (thematic_id)'); - $this->addSql('CREATE TABLE financed_projects_actors (project_id INT NOT NULL, actor_id UUID NOT NULL, PRIMARY KEY(project_id, actor_id))'); - $this->addSql('CREATE INDEX IDX_50C6B8EC166D1F9C ON financed_projects_actors (project_id)'); - $this->addSql('CREATE INDEX IDX_50C6B8EC10DAF24A ON financed_projects_actors (actor_id)'); - $this->addSql('COMMENT ON COLUMN financed_projects_actors.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE contracted_projects_actors (project_id INT NOT NULL, actor_id UUID NOT NULL, PRIMARY KEY(project_id, actor_id))'); - $this->addSql('CREATE INDEX IDX_E73AB790166D1F9C ON contracted_projects_actors (project_id)'); - $this->addSql('CREATE INDEX IDX_E73AB79010DAF24A ON contracted_projects_actors (actor_id)'); - $this->addSql('COMMENT ON COLUMN contracted_projects_actors.actor_id IS \'(DC2Type:uuid)\''); - $this->addSql('CREATE TABLE thematic (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE TABLE "user" (id INT NOT NULL, logo_id INT DEFAULT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) DEFAULT NULL, is_validated BOOLEAN NOT NULL, requested_roles JSON DEFAULT NULL, organisation VARCHAR(255) DEFAULT NULL, position VARCHAR(255) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, sign_up_message TEXT DEFAULT NULL, description TEXT DEFAULT NULL, PRIMARY KEY(id))'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649F98F144A ON "user" (logo_id)'); - $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F9F98F144A FOREIGN KEY (logo_id) REFERENCES media_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F9DE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F916FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_actor_expertise ADD CONSTRAINT FK_4A438EAD10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_actor_expertise ADD CONSTRAINT FK_4A438EAD916905AC FOREIGN KEY (actor_expertise_id) REFERENCES actor_expertise (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_thematic ADD CONSTRAINT FK_D159A26410DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_thematic ADD CONSTRAINT FK_D159A2642395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_administrative_scope ADD CONSTRAINT FK_65EBE3CC10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_administrative_scope ADD CONSTRAINT FK_65EBE3CCC1892E43 FOREIGN KEY (administrative_scope_id) REFERENCES administrative_scope (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_media_object ADD CONSTRAINT FK_18E6A66710DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE actor_media_object ADD CONSTRAINT FK_18E6A66764DE5A5 FOREIGN KEY (media_object_id) REFERENCES media_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EE10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EEDE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EE16FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE project_thematic ADD CONSTRAINT FK_415254A9166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE project_thematic ADD CONSTRAINT FK_415254A92395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE financed_projects_actors ADD CONSTRAINT FK_50C6B8EC166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE financed_projects_actors ADD CONSTRAINT FK_50C6B8EC10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE contracted_projects_actors ADD CONSTRAINT FK_E73AB790166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE contracted_projects_actors ADD CONSTRAINT FK_E73AB79010DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); - $this->addSql('ALTER TABLE "user" ADD CONSTRAINT FK_8D93D649F98F144A FOREIGN KEY (logo_id) REFERENCES media_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE SCHEMA public'); - $this->addSql('DROP SEQUENCE actor_expertise_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE administrative_scope_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE media_object_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE project_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE thematic_id_seq CASCADE'); - $this->addSql('DROP SEQUENCE "user_id_seq" CASCADE'); - $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F9F98F144A'); - $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F9DE12AB56'); - $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F916FE72E1'); - $this->addSql('ALTER TABLE actor_actor_expertise DROP CONSTRAINT FK_4A438EAD10DAF24A'); - $this->addSql('ALTER TABLE actor_actor_expertise DROP CONSTRAINT FK_4A438EAD916905AC'); - $this->addSql('ALTER TABLE actor_thematic DROP CONSTRAINT FK_D159A26410DAF24A'); - $this->addSql('ALTER TABLE actor_thematic DROP CONSTRAINT FK_D159A2642395FCED'); - $this->addSql('ALTER TABLE actor_administrative_scope DROP CONSTRAINT FK_65EBE3CC10DAF24A'); - $this->addSql('ALTER TABLE actor_administrative_scope DROP CONSTRAINT FK_65EBE3CCC1892E43'); - $this->addSql('ALTER TABLE actor_media_object DROP CONSTRAINT FK_18E6A66710DAF24A'); - $this->addSql('ALTER TABLE actor_media_object DROP CONSTRAINT FK_18E6A66764DE5A5'); - $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EE10DAF24A'); - $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EEDE12AB56'); - $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EE16FE72E1'); - $this->addSql('ALTER TABLE project_thematic DROP CONSTRAINT FK_415254A9166D1F9C'); - $this->addSql('ALTER TABLE project_thematic DROP CONSTRAINT FK_415254A92395FCED'); - $this->addSql('ALTER TABLE financed_projects_actors DROP CONSTRAINT FK_50C6B8EC166D1F9C'); - $this->addSql('ALTER TABLE financed_projects_actors DROP CONSTRAINT FK_50C6B8EC10DAF24A'); - $this->addSql('ALTER TABLE contracted_projects_actors DROP CONSTRAINT FK_E73AB790166D1F9C'); - $this->addSql('ALTER TABLE contracted_projects_actors DROP CONSTRAINT FK_E73AB79010DAF24A'); - $this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D649F98F144A'); - $this->addSql('DROP TABLE actor'); - $this->addSql('DROP TABLE actor_actor_expertise'); - $this->addSql('DROP TABLE actor_thematic'); - $this->addSql('DROP TABLE actor_administrative_scope'); - $this->addSql('DROP TABLE actor_media_object'); - $this->addSql('DROP TABLE actor_expertise'); - $this->addSql('DROP TABLE administrative_scope'); - $this->addSql('DROP TABLE media_object'); - $this->addSql('DROP TABLE project'); - $this->addSql('DROP TABLE project_thematic'); - $this->addSql('DROP TABLE financed_projects_actors'); - $this->addSql('DROP TABLE contracted_projects_actors'); - $this->addSql('DROP TABLE thematic'); - $this->addSql('DROP TABLE "user"'); - } -} diff --git a/symfony/migrations/Version20241106170537.php b/symfony/migrations/Version20241106170537.php new file mode 100644 index 0000000..bf0c539 --- /dev/null +++ b/symfony/migrations/Version20241106170537.php @@ -0,0 +1,31 @@ +addSql('CREATE SCHEMA public'); + } +} diff --git a/symfony/src/DataFixtures/Processor/ActorProjectProcessor.php b/symfony/src/DataFixtures/Processor/ActorProjectProcessor.php index 57efd0a..fbc405e 100644 --- a/symfony/src/DataFixtures/Processor/ActorProjectProcessor.php +++ b/symfony/src/DataFixtures/Processor/ActorProjectProcessor.php @@ -11,7 +11,7 @@ public function preProcess(string $fixtureId, $object): void { // For testing purpose static $callCount = 0; - if ($object instanceof Actor) { + if ($object instanceof Actor || $object instanceof Project) { $callCount++; $isValidated = $callCount % 4 !== 0; $object->setIsValidated($isValidated); diff --git a/symfony/src/Entity/Actor.php b/symfony/src/Entity/Actor.php index 1ea1246..698e2ed 100644 --- a/symfony/src/Entity/Actor.php +++ b/symfony/src/Entity/Actor.php @@ -23,10 +23,11 @@ use App\Entity\Trait\SluggableEntity; use ApiPlatform\Metadata\GetCollection; use App\Entity\Trait\TimestampableEntity; +use App\Entity\Trait\ToValidateEntity; use Doctrine\Common\Collections\Collection; use Jsor\Doctrine\PostGIS\Types\PostGISType; use App\Services\State\Provider\ActorProvider; -use App\Services\State\Processor\ActorProcessor; +use App\Services\State\Processor\ValidateEntityProcessor; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -42,15 +43,15 @@ ), new Get(), new Post( - processor: ActorProcessor::class, + processor: ValidateEntityProcessor::class, security: "is_granted('".UserRoles::ROLE_EDITOR_ACTORS."')" ), new Patch( - processor: ActorProcessor::class, + processor: ValidateEntityProcessor::class, security: 'is_granted("'.ActorVoter::EDIT.'", object)' ), new Put( - processor: ActorProcessor::class, + processor: ValidateEntityProcessor::class, security: 'is_granted("'.ActorVoter::EDIT.'", object)' ), new Delete( @@ -69,6 +70,7 @@ class Actor use TimestampableEntity; use SluggableEntity; use BlameableEntity; + use ToValidateEntity; #[ORM\Id] #[ORM\Column(type: 'uuid', unique: true)] @@ -85,10 +87,6 @@ class Actor #[Groups([self::ACTOR_READ_COLLECTION, self::ACTOR_READ_ITEM, self::ACTOR_WRITE, Project::PROJECT_READ_ALL, Project::PROJECT_READ])] private ?string $acronym = null; - #[ORM\Column] - #[Groups([self::ACTOR_READ_ITEM, self::ACTOR_READ_COLLECTION])] - private ?bool $isValidated = false; - #[ORM\Column(enumType: ActorCategory::class)] #[Groups([self::ACTOR_READ_COLLECTION, self::ACTOR_READ_ITEM, self::ACTOR_WRITE, Project::PROJECT_READ])] private ?ActorCategory $category = null; @@ -216,18 +214,6 @@ public function setAcronym(string $acronym): static return $this; } - public function getIsValidated(): ?bool - { - return $this->isValidated; - } - - public function setIsValidated(bool $isValidated): static - { - $this->isValidated = $isValidated; - - return $this; - } - public function getCategory(): ?ActorCategory { return $this->category; diff --git a/symfony/src/Entity/Project.php b/symfony/src/Entity/Project.php index 7774d6c..3c45872 100644 --- a/symfony/src/Entity/Project.php +++ b/symfony/src/Entity/Project.php @@ -2,25 +2,27 @@ namespace App\Entity; -use ApiPlatform\Doctrine\Common\Filter\SearchFilterInterface; -use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; -use ApiPlatform\Metadata\ApiFilter; -use ApiPlatform\Metadata\GetCollection; -use App\Enum\AdministrativeScope; use App\Enum\Status; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use App\Enum\AdministrativeScope; +use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; -use ApiPlatform\Metadata\QueryParameter; -use App\Controller\Project\SimilarProjectsAction; -use App\Repository\ProjectRepository; +use App\Entity\Trait\BlameableEntity; use App\Entity\Trait\SluggableEntity; +use App\Repository\ProjectRepository; +use App\Entity\Trait\ToValidateEntity; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\QueryParameter; use App\Entity\Trait\TimestampableEntity; -use App\Entity\Trait\BlameableEntity; use Doctrine\Common\Collections\Collection; use Jsor\Doctrine\PostGIS\Types\PostGISType; use Doctrine\Common\Collections\ArrayCollection; +use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; +use App\Controller\Project\SimilarProjectsAction; use Symfony\Component\Serializer\Attribute\Groups; +use ApiPlatform\Doctrine\Common\Filter\SearchFilterInterface; +use App\Services\State\Provider\ProjectProvider; #[ORM\Entity(repositoryClass: ProjectRepository::class)] #[ApiFilter(filterClass: SearchFilter::class, properties: ['slug' => SearchFilterInterface::STRATEGY_EXACT])] @@ -28,6 +30,7 @@ paginationEnabled: false, operations: [ new GetCollection( + provider: ProjectProvider::class, uriTemplate: '/projects/all', normalizationContext: ['groups' => [self::PROJECT_READ_ALL]] ), @@ -49,6 +52,7 @@ class Project use TimestampableEntity; use BlameableEntity; use SluggableEntity; + use ToValidateEntity; public const PROJECT_READ = 'project:read'; public const PROJECT_READ_ALL = 'project:read:all'; diff --git a/symfony/src/Entity/Trait/ToValidateEntity.php b/symfony/src/Entity/Trait/ToValidateEntity.php new file mode 100644 index 0000000..1676c6c --- /dev/null +++ b/symfony/src/Entity/Trait/ToValidateEntity.php @@ -0,0 +1,27 @@ +isValidated; + } + + public function setIsValidated(bool $isValidated): static + { + $this->isValidated = $isValidated; + + return $this; + } +} diff --git a/symfony/src/Services/State/Processor/ActorProcessor.php b/symfony/src/Services/State/Processor/ValidateEntityProcessor.php similarity index 94% rename from symfony/src/Services/State/Processor/ActorProcessor.php rename to symfony/src/Services/State/Processor/ValidateEntityProcessor.php index 5159538..c6da665 100644 --- a/symfony/src/Services/State/Processor/ActorProcessor.php +++ b/symfony/src/Services/State/Processor/ValidateEntityProcessor.php @@ -10,7 +10,7 @@ use Symfony\Bundle\SecurityBundle\Security; use Symfony\Component\HttpFoundation\RequestStack; -class ActorProcessor implements ProcessorInterface +class ValidateEntityProcessor implements ProcessorInterface { diff --git a/symfony/src/Services/State/Provider/ProjectProvider.php b/symfony/src/Services/State/Provider/ProjectProvider.php new file mode 100644 index 0000000..4944d13 --- /dev/null +++ b/symfony/src/Services/State/Provider/ProjectProvider.php @@ -0,0 +1,28 @@ +security->isGranted(UserRoles::ROLE_ADMIN)) { + return $this->projectRepository->findAll(); + } + + return $this->projectRepository->findBy(['isValidated' => true]); + } +} \ No newline at end of file diff --git a/vue/src/stores/actorsStore.ts b/vue/src/stores/actorsStore.ts index b5f5f7b..a18108c 100644 --- a/vue/src/stores/actorsStore.ts +++ b/vue/src/stores/actorsStore.ts @@ -20,10 +20,12 @@ export const useActorsStore = defineStore(StoresList.ACTORS, () => { const actorsThematics: Thematic[] = reactive([]) const actorsAdministrativesScopes: AdministrativeScope[] = reactive([]) - async function getActors(): Promise { + async function getActors(forceGet = false): Promise { + if (actors.length === 0 || forceGet) { actors.splice(0, actors.length) actors.push(...await ActorsService.getActors()) dataLoaded.value = true + } } async function getActorsSelectListContent(): Promise { diff --git a/vue/src/stores/applicationStore.ts b/vue/src/stores/applicationStore.ts index 63402cc..5a3ebac 100644 --- a/vue/src/stores/applicationStore.ts +++ b/vue/src/stores/applicationStore.ts @@ -9,6 +9,7 @@ import { useProjectStore } from '@/stores/projectStore' import { DialogKey } from '@/models/enums/app/DialogKey' import type { Ref } from 'vue' import { ContentPagesList } from '@/models/enums/app/ContentPagesList' +import { useActorsStore } from './actorsStore' export const useApplicationStore = defineStore(StoresList.APPLICATION, () => { const { mobile } = useDisplay() @@ -35,5 +36,12 @@ export const useApplicationStore = defineStore(StoresList.APPLICATION, () => { return route.name && typeof route.name === 'string' && lightUiRoutes.includes(route.name) }) - return { mobile, showSnackBar, snackBarMessage, activeTab, activeDialog, breadcrumbs, is100vh, isLightHeader, triggerZoomReset, showEditContentDialog, currentContentPage } + const refreshAppData = () => { + const actorsStore = useActorsStore() + actorsStore.getActors(true) + const projectStore = useProjectStore() + projectStore.getAll(true) + } + + return { mobile, showSnackBar, snackBarMessage, activeTab, activeDialog, breadcrumbs, is100vh, isLightHeader, triggerZoomReset, showEditContentDialog, currentContentPage, refreshAppData } }) diff --git a/vue/src/stores/projectStore.ts b/vue/src/stores/projectStore.ts index 2baade1..ce9bf7e 100644 --- a/vue/src/stores/projectStore.ts +++ b/vue/src/stores/projectStore.ts @@ -39,8 +39,8 @@ export const useProjectStore = defineStore(StoresList.PROJECTS, () => { financialActors: [], }) - async function getAll(): Promise { - if (projects.value.length === 0) { + async function getAll(forceGet = false): Promise { + if (projects.value.length === 0 || forceGet) { projects.value = await ProjectService.getAll() } } diff --git a/vue/src/stores/userStore.ts b/vue/src/stores/userStore.ts index 9bcb5ee..a0b0a4e 100644 --- a/vue/src/stores/userStore.ts +++ b/vue/src/stores/userStore.ts @@ -12,6 +12,7 @@ import { UserRoles } from '@/models/enums/auth/UserRoles' import { ImageLoader } from '@/services/files/ImageLoader' import type { MediaObject } from '@/models/interfaces/MediaObject' import { UserService } from '@/services/userAndAuth/UserService' +import { useApplicationStore } from './applicationStore' export const useUserStore = defineStore(StoresList.USER, () => { @@ -44,6 +45,8 @@ export const useUserStore = defineStore(StoresList.USER, () => { const setCurrentUser = async () => { currentUser.value = (await AuthenticationService.getAuthenticatedUser()).data + const appStore = useApplicationStore() + appStore.refreshAppData() } const signUp = async (values: SignUpValues) => { @@ -65,6 +68,8 @@ export const useUserStore = defineStore(StoresList.USER, () => { currentUser.value = null JwtCookie.clearCookies() router.push({ name: 'home' }) + const appStore = useApplicationStore() + appStore.refreshAppData() } const checkAuthenticated = async () => { diff --git a/vue/src/views/actors/ActorsView.vue b/vue/src/views/actors/ActorsView.vue index 36e0311..0db1238 100644 --- a/vue/src/views/actors/ActorsView.vue +++ b/vue/src/views/actors/ActorsView.vue @@ -72,7 +72,7 @@
- {{ `${actorsStore.actors.length.toString()} ${actorsStore.actors.length > 1 ? $t('actors.actors') : $t('actors.actor')}` }} + {{ `${totalActors.length.toString()} ${$t('admin.member', totalActors.length)}`}} {{ $t('actors.resetFilters') }}
{{ filteredActors.length }}
@@ -138,8 +138,9 @@ const selectedAdminScope: Ref = ref(null); const categoryItems = Object.values(ActorsCategories) const selectedCategory: Ref = ref(null); +const totalActors = computed(() => actorsStore.actors.filter(x => x.isValidated)) const filteredActors = computed(() => { - let filteredActors = [...actorsStore.actors] + let filteredActors = [...totalActors.value] if (searchQuery.value) { filteredActors = filteredActors.filter((actor: Actor) => { From cdb9fe7876aa1e24473de860456f095a8300c87d Mon Sep 17 00:00:00 2001 From: Pierre-Louis Date: Wed, 13 Nov 2024 17:41:40 +0100 Subject: [PATCH 2/2] fix: migrations --- symfony/migrations/Version20241106170537.php | 31 ---- symfony/migrations/Version20241113164118.php | 144 +++++++++++++++++++ 2 files changed, 144 insertions(+), 31 deletions(-) delete mode 100644 symfony/migrations/Version20241106170537.php create mode 100644 symfony/migrations/Version20241113164118.php diff --git a/symfony/migrations/Version20241106170537.php b/symfony/migrations/Version20241106170537.php deleted file mode 100644 index bf0c539..0000000 --- a/symfony/migrations/Version20241106170537.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('CREATE SCHEMA public'); - } -} diff --git a/symfony/migrations/Version20241113164118.php b/symfony/migrations/Version20241113164118.php new file mode 100644 index 0000000..536f0b5 --- /dev/null +++ b/symfony/migrations/Version20241113164118.php @@ -0,0 +1,144 @@ +addSql('CREATE SEQUENCE actor_expertise_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE administrative_scope_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE media_object_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE project_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE thematic_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE actor (id UUID NOT NULL, logo_id INT DEFAULT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, name VARCHAR(255) NOT NULL, acronym VARCHAR(255) NOT NULL, category VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, office_name VARCHAR(255) DEFAULT NULL, office_address VARCHAR(255) DEFAULT NULL, office_location geometry(POINT, 0) DEFAULT NULL, contact_name VARCHAR(255) DEFAULT NULL, contact_position VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, phone VARCHAR(255) DEFAULT NULL, email VARCHAR(255) DEFAULT NULL, external_images TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, slug VARCHAR(128) DEFAULT NULL, is_validated BOOLEAN NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_447556F9989D9B62 ON actor (slug)'); + $this->addSql('CREATE INDEX IDX_447556F9F98F144A ON actor (logo_id)'); + $this->addSql('CREATE INDEX IDX_447556F9DE12AB56 ON actor (created_by)'); + $this->addSql('CREATE INDEX IDX_447556F916FE72E1 ON actor (updated_by)'); + $this->addSql('COMMENT ON COLUMN actor.id IS \'(DC2Type:uuid)\''); + $this->addSql('COMMENT ON COLUMN actor.external_images IS \'(DC2Type:simple_array)\''); + $this->addSql('CREATE TABLE actor_actor_expertise (actor_id UUID NOT NULL, actor_expertise_id INT NOT NULL, PRIMARY KEY(actor_id, actor_expertise_id))'); + $this->addSql('CREATE INDEX IDX_4A438EAD10DAF24A ON actor_actor_expertise (actor_id)'); + $this->addSql('CREATE INDEX IDX_4A438EAD916905AC ON actor_actor_expertise (actor_expertise_id)'); + $this->addSql('COMMENT ON COLUMN actor_actor_expertise.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE actor_thematic (actor_id UUID NOT NULL, thematic_id INT NOT NULL, PRIMARY KEY(actor_id, thematic_id))'); + $this->addSql('CREATE INDEX IDX_D159A26410DAF24A ON actor_thematic (actor_id)'); + $this->addSql('CREATE INDEX IDX_D159A2642395FCED ON actor_thematic (thematic_id)'); + $this->addSql('COMMENT ON COLUMN actor_thematic.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE actor_administrative_scope (actor_id UUID NOT NULL, administrative_scope_id INT NOT NULL, PRIMARY KEY(actor_id, administrative_scope_id))'); + $this->addSql('CREATE INDEX IDX_65EBE3CC10DAF24A ON actor_administrative_scope (actor_id)'); + $this->addSql('CREATE INDEX IDX_65EBE3CCC1892E43 ON actor_administrative_scope (administrative_scope_id)'); + $this->addSql('COMMENT ON COLUMN actor_administrative_scope.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE actor_media_object (actor_id UUID NOT NULL, media_object_id INT NOT NULL, PRIMARY KEY(actor_id, media_object_id))'); + $this->addSql('CREATE INDEX IDX_18E6A66710DAF24A ON actor_media_object (actor_id)'); + $this->addSql('CREATE INDEX IDX_18E6A66764DE5A5 ON actor_media_object (media_object_id)'); + $this->addSql('COMMENT ON COLUMN actor_media_object.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE actor_expertise (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE administrative_scope (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE media_object (id INT NOT NULL, file_path VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE project (id INT NOT NULL, actor_id UUID NOT NULL, created_by INT DEFAULT NULL, updated_by INT DEFAULT NULL, name VARCHAR(255) NOT NULL, location VARCHAR(255) NOT NULL, coords geometry(POINT, 0) NOT NULL, status VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, images JSON DEFAULT NULL, partners JSON DEFAULT NULL, intervention_zone VARCHAR(255) NOT NULL, project_manager_name VARCHAR(255) DEFAULT NULL, project_manager_position VARCHAR(255) DEFAULT NULL, project_manager_email VARCHAR(255) DEFAULT NULL, project_manager_tel VARCHAR(255) DEFAULT NULL, project_manager_photo VARCHAR(255) DEFAULT NULL, website VARCHAR(255) DEFAULT NULL, logo VARCHAR(255) DEFAULT NULL, deliverables TEXT DEFAULT NULL, calendar TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, slug VARCHAR(128) DEFAULT NULL, is_validated BOOLEAN NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_2FB3D0EE989D9B62 ON project (slug)'); + $this->addSql('CREATE INDEX IDX_2FB3D0EE10DAF24A ON project (actor_id)'); + $this->addSql('CREATE INDEX IDX_2FB3D0EEDE12AB56 ON project (created_by)'); + $this->addSql('CREATE INDEX IDX_2FB3D0EE16FE72E1 ON project (updated_by)'); + $this->addSql('COMMENT ON COLUMN project.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE project_thematic (project_id INT NOT NULL, thematic_id INT NOT NULL, PRIMARY KEY(project_id, thematic_id))'); + $this->addSql('CREATE INDEX IDX_415254A9166D1F9C ON project_thematic (project_id)'); + $this->addSql('CREATE INDEX IDX_415254A92395FCED ON project_thematic (thematic_id)'); + $this->addSql('CREATE TABLE financed_projects_actors (project_id INT NOT NULL, actor_id UUID NOT NULL, PRIMARY KEY(project_id, actor_id))'); + $this->addSql('CREATE INDEX IDX_50C6B8EC166D1F9C ON financed_projects_actors (project_id)'); + $this->addSql('CREATE INDEX IDX_50C6B8EC10DAF24A ON financed_projects_actors (actor_id)'); + $this->addSql('COMMENT ON COLUMN financed_projects_actors.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE contracted_projects_actors (project_id INT NOT NULL, actor_id UUID NOT NULL, PRIMARY KEY(project_id, actor_id))'); + $this->addSql('CREATE INDEX IDX_E73AB790166D1F9C ON contracted_projects_actors (project_id)'); + $this->addSql('CREATE INDEX IDX_E73AB79010DAF24A ON contracted_projects_actors (actor_id)'); + $this->addSql('COMMENT ON COLUMN contracted_projects_actors.actor_id IS \'(DC2Type:uuid)\''); + $this->addSql('CREATE TABLE thematic (id INT NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE "user" (id INT NOT NULL, logo_id INT DEFAULT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(180) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) DEFAULT NULL, is_validated BOOLEAN NOT NULL, requested_roles JSON DEFAULT NULL, organisation VARCHAR(255) DEFAULT NULL, position VARCHAR(255) DEFAULT NULL, phone VARCHAR(20) DEFAULT NULL, sign_up_message TEXT DEFAULT NULL, description TEXT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649F98F144A ON "user" (logo_id)'); + $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F9F98F144A FOREIGN KEY (logo_id) REFERENCES media_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F9DE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor ADD CONSTRAINT FK_447556F916FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_actor_expertise ADD CONSTRAINT FK_4A438EAD10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_actor_expertise ADD CONSTRAINT FK_4A438EAD916905AC FOREIGN KEY (actor_expertise_id) REFERENCES actor_expertise (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_thematic ADD CONSTRAINT FK_D159A26410DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_thematic ADD CONSTRAINT FK_D159A2642395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_administrative_scope ADD CONSTRAINT FK_65EBE3CC10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_administrative_scope ADD CONSTRAINT FK_65EBE3CCC1892E43 FOREIGN KEY (administrative_scope_id) REFERENCES administrative_scope (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_media_object ADD CONSTRAINT FK_18E6A66710DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE actor_media_object ADD CONSTRAINT FK_18E6A66764DE5A5 FOREIGN KEY (media_object_id) REFERENCES media_object (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EE10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EEDE12AB56 FOREIGN KEY (created_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE project ADD CONSTRAINT FK_2FB3D0EE16FE72E1 FOREIGN KEY (updated_by) REFERENCES "user" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE project_thematic ADD CONSTRAINT FK_415254A9166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE project_thematic ADD CONSTRAINT FK_415254A92395FCED FOREIGN KEY (thematic_id) REFERENCES thematic (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE financed_projects_actors ADD CONSTRAINT FK_50C6B8EC166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE financed_projects_actors ADD CONSTRAINT FK_50C6B8EC10DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE contracted_projects_actors ADD CONSTRAINT FK_E73AB790166D1F9C FOREIGN KEY (project_id) REFERENCES project (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE contracted_projects_actors ADD CONSTRAINT FK_E73AB79010DAF24A FOREIGN KEY (actor_id) REFERENCES actor (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE "user" ADD CONSTRAINT FK_8D93D649F98F144A FOREIGN KEY (logo_id) REFERENCES media_object (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('DROP SEQUENCE actor_expertise_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE administrative_scope_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE media_object_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE project_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE thematic_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE "user_id_seq" CASCADE'); + $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F9F98F144A'); + $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F9DE12AB56'); + $this->addSql('ALTER TABLE actor DROP CONSTRAINT FK_447556F916FE72E1'); + $this->addSql('ALTER TABLE actor_actor_expertise DROP CONSTRAINT FK_4A438EAD10DAF24A'); + $this->addSql('ALTER TABLE actor_actor_expertise DROP CONSTRAINT FK_4A438EAD916905AC'); + $this->addSql('ALTER TABLE actor_thematic DROP CONSTRAINT FK_D159A26410DAF24A'); + $this->addSql('ALTER TABLE actor_thematic DROP CONSTRAINT FK_D159A2642395FCED'); + $this->addSql('ALTER TABLE actor_administrative_scope DROP CONSTRAINT FK_65EBE3CC10DAF24A'); + $this->addSql('ALTER TABLE actor_administrative_scope DROP CONSTRAINT FK_65EBE3CCC1892E43'); + $this->addSql('ALTER TABLE actor_media_object DROP CONSTRAINT FK_18E6A66710DAF24A'); + $this->addSql('ALTER TABLE actor_media_object DROP CONSTRAINT FK_18E6A66764DE5A5'); + $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EE10DAF24A'); + $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EEDE12AB56'); + $this->addSql('ALTER TABLE project DROP CONSTRAINT FK_2FB3D0EE16FE72E1'); + $this->addSql('ALTER TABLE project_thematic DROP CONSTRAINT FK_415254A9166D1F9C'); + $this->addSql('ALTER TABLE project_thematic DROP CONSTRAINT FK_415254A92395FCED'); + $this->addSql('ALTER TABLE financed_projects_actors DROP CONSTRAINT FK_50C6B8EC166D1F9C'); + $this->addSql('ALTER TABLE financed_projects_actors DROP CONSTRAINT FK_50C6B8EC10DAF24A'); + $this->addSql('ALTER TABLE contracted_projects_actors DROP CONSTRAINT FK_E73AB790166D1F9C'); + $this->addSql('ALTER TABLE contracted_projects_actors DROP CONSTRAINT FK_E73AB79010DAF24A'); + $this->addSql('ALTER TABLE "user" DROP CONSTRAINT FK_8D93D649F98F144A'); + $this->addSql('DROP TABLE actor'); + $this->addSql('DROP TABLE actor_actor_expertise'); + $this->addSql('DROP TABLE actor_thematic'); + $this->addSql('DROP TABLE actor_administrative_scope'); + $this->addSql('DROP TABLE actor_media_object'); + $this->addSql('DROP TABLE actor_expertise'); + $this->addSql('DROP TABLE administrative_scope'); + $this->addSql('DROP TABLE media_object'); + $this->addSql('DROP TABLE project'); + $this->addSql('DROP TABLE project_thematic'); + $this->addSql('DROP TABLE financed_projects_actors'); + $this->addSql('DROP TABLE contracted_projects_actors'); + $this->addSql('DROP TABLE thematic'); + $this->addSql('DROP TABLE "user"'); + } +}