-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* General convention * Fix adherent cascade * Add endpoints + fix review
- Loading branch information
Showing
18 changed files
with
865 additions
and
4 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
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,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" | ||
} | ||
""" |
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,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'); | ||
} | ||
} |
Oops, something went wrong.