Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General convention #11412

Merged
merged 3 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/packages/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ security:
- ROLE_APP_ADMIN_PROCURATION_V2_REQUEST_ALL
- ROLE_APP_ADMIN_PROCURATION_V2_PROXY_ALL
- ROLE_APP_ADMIN_PROCURATION_V2_PROCURATION_REQUEST_ALL
ROLE_ADMIN_TERRITOIRES_GENERAL_CONVENTIONS:
- ROLE_APP_ADMIN_GENERAL_CONVENTION_ALL

## Application Mobile
ROLE_ADMIN_APPLICATION_MOBILE_NOTIFICATIONS:
Expand Down
8 changes: 8 additions & 0 deletions config/services/admin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,14 @@
</service>
<service id="App\Admin\ReportAdmin" alias="app.admin.report" />

<service id="app.admin.general_convention" class="App\Admin\GeneralConventionAdmin">
<tag name="sonata.admin" manager-type="orm" label="États généraux" group="Territoires" />

<argument />
<argument>App\Entity\GeneralConvention\GeneralConvention</argument>
<argument />
</service>

<!--
######################################################
# Mobilisation
Expand Down
121 changes: 121 additions & 0 deletions features/api/general_conventions.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
@api
Feature:
In order to display general conventions informations
As an anonymous user
I should be able to list and read general conventions

Scenario: As an anonymous user, I can list general conventions
And I send a "GET" request to "/api/general_conventions?page_size=10"
Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
{
"metadata": {
"total_items": 3,
"items_per_page": 10,
"count": 3,
"current_page": 1,
"last_page": 1
},
"items": [
{
"department_zone": {
"uuid": "@uuid@",
"type": "department",
"code": "92",
"name": "Hauts-de-Seine"
},
"committee_zone": null,
"district_zone": null,
"organizer": "assembly",
"reported_at": "@[email protected]()",
"meeting_type": "on_site",
"members_count": 0,
"participant_quality": "adherent",
"uuid": "c5317499-7130-4255-a7f8-418e72f5dfa5"
},
{
"department_zone": {
"uuid": "@uuid@",
"type": "department",
"code": "92",
"name": "Hauts-de-Seine"
},
"committee_zone": {
"uuid": "@uuid@",
"type": "city",
"code": "92024",
"name": "Clichy"
},
"district_zone": null,
"organizer": "committee",
"reported_at": "@[email protected]()",
"meeting_type": "remote",
"members_count": 20,
"participant_quality": "sympathizer",
"uuid": "b3a2b082-01fc-4306-9fdb-6559ebe765b1"
},
{
"department_zone": {
"uuid": "@uuid@",
"type": "department",
"code": "92",
"name": "Hauts-de-Seine"
},
"committee_zone": null,
"district_zone": {
"uuid": "@uuid@",
"type": "district",
"code": "92-4",
"name": "Hauts-de-Seine (4)"
},
"organizer": "district",
"reported_at": "@[email protected]()",
"meeting_type": "remote",
"members_count": 10,
"participant_quality": "adherent_before",
"uuid": "54c9ae4c-3e2d-475d-8993-54639ec58ea1"
}
]
}
"""

Scenario: As an anonymous user, I can get informations of a general convention
And I send a "GET" request to "/api/general_conventions/c5317499-7130-4255-a7f8-418e72f5dfa5"
Then the response status code should be 200
And the response should be in JSON
And the JSON should be equal to:
"""
{
"department_zone": {
"uuid": "@uuid@",
"type": "department",
"code": "92",
"name": "Hauts-de-Seine"
},
"committee_zone": null,
"district_zone": null,
"organizer": "assembly",
"reported_at": "@[email protected]()",
"meeting_type": "on_site",
"members_count": 0,
"participant_quality": "adherent",
"general_summary": null,
"party_definition_summary": null,
"unique_party_summary": null,
"progress_since2016": null,
"party_objectives": null,
"governance": null,
"communication": null,
"militant_training": null,
"member_journey": null,
"mobilization": null,
"talent_detection": null,
"election_preparation": null,
"relationship_with_supporters": null,
"work_with_partners": null,
"additional_comments": null,
"uuid": "c5317499-7130-4255-a7f8-418e72f5dfa5"
}
"""
94 changes: 94 additions & 0 deletions migrations/2025/Version20250131111843.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php

namespace Migrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

final class Version20250131111843 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('CREATE TABLE general_convention (
id INT UNSIGNED AUTO_INCREMENT NOT NULL,
department_zone_id INT UNSIGNED NOT NULL,
committee_zone_id INT UNSIGNED DEFAULT NULL,
district_zone_id INT UNSIGNED DEFAULT NULL,
reporter_id INT UNSIGNED DEFAULT NULL,
created_by_administrator_id INT DEFAULT NULL,
updated_by_administrator_id INT DEFAULT NULL,
organizer VARCHAR(255) NOT NULL,
reported_at DATETIME NOT NULL,
meeting_type VARCHAR(255) NOT NULL,
members_count SMALLINT UNSIGNED DEFAULT 0 NOT NULL,
participant_quality VARCHAR(255) NOT NULL,
general_summary LONGTEXT DEFAULT NULL,
party_definition_summary LONGTEXT DEFAULT NULL,
unique_party_summary LONGTEXT DEFAULT NULL,
progress_since2016 LONGTEXT DEFAULT NULL,
party_objectives LONGTEXT DEFAULT NULL,
governance LONGTEXT DEFAULT NULL,
communication LONGTEXT DEFAULT NULL,
militant_training LONGTEXT DEFAULT NULL,
member_journey LONGTEXT DEFAULT NULL,
mobilization LONGTEXT DEFAULT NULL,
talent_detection LONGTEXT DEFAULT NULL,
election_preparation LONGTEXT DEFAULT NULL,
relationship_with_supporters LONGTEXT DEFAULT NULL,
work_with_partners LONGTEXT DEFAULT NULL,
additional_comments LONGTEXT DEFAULT NULL,
uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\',
created_at DATETIME NOT NULL,
updated_at DATETIME NOT NULL,
UNIQUE INDEX UNIQ_F66947EFD17F50A6 (uuid),
INDEX IDX_F66947EF2285D748 (department_zone_id),
INDEX IDX_F66947EF94819E3B (committee_zone_id),
INDEX IDX_F66947EF23F5C396 (district_zone_id),
INDEX IDX_F66947EFE1CFE6F5 (reporter_id),
INDEX IDX_F66947EF9DF5350C (created_by_administrator_id),
INDEX IDX_F66947EFCF1918FF (updated_by_administrator_id),
PRIMARY KEY(id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EF2285D748 FOREIGN KEY (department_zone_id) REFERENCES geo_zone (id)');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EF94819E3B FOREIGN KEY (committee_zone_id) REFERENCES geo_zone (id)');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EF23F5C396 FOREIGN KEY (district_zone_id) REFERENCES geo_zone (id)');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EFE1CFE6F5 FOREIGN KEY (reporter_id) REFERENCES adherents (id) ON DELETE
SET
NULL');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EF9DF5350C FOREIGN KEY (created_by_administrator_id) REFERENCES administrators (id) ON DELETE
SET
NULL');
$this->addSql('ALTER TABLE
general_convention
ADD
CONSTRAINT FK_F66947EFCF1918FF FOREIGN KEY (updated_by_administrator_id) REFERENCES administrators (id) ON DELETE
SET
NULL');
}

public function down(Schema $schema): void
{
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF2285D748');
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF94819E3B');
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF23F5C396');
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EFE1CFE6F5');
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EF9DF5350C');
$this->addSql('ALTER TABLE general_convention DROP FOREIGN KEY FK_F66947EFCF1918FF');
$this->addSql('DROP TABLE general_convention');
}
}
Loading