Skip to content

Commit

Permalink
fix(data): Review validated fields for actors and projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Ribiere committed Nov 6, 2024
1 parent db17b15 commit 6edb5eb
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 181 deletions.
144 changes: 0 additions & 144 deletions symfony/migrations/Version20241105102005.php

This file was deleted.

31 changes: 31 additions & 0 deletions symfony/migrations/Version20241106170537.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

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

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20241106170537 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs

}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
26 changes: 6 additions & 20 deletions symfony/src/Entity/Actor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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(
Expand All @@ -69,6 +70,7 @@ class Actor
use TimestampableEntity;
use SluggableEntity;
use BlameableEntity;
use ToValidateEntity;

#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 6edb5eb

Please sign in to comment.