| @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; | |||||
| /** | /** | ||||
| * Auto-generated Migration: Please modify to your needs! | * Auto-generated Migration: Please modify to your needs! | ||||
| */ | */ | ||||
| final class Version20240516084219 extends AbstractMigration | |||||
| final class Version20240607092001 extends AbstractMigration | |||||
| { | { | ||||
| public function getDescription(): string | public function getDescription(): string | ||||
| { | { | ||||
| @@ -30,11 +30,11 @@ final class Version20240516084219 extends AbstractMigration | |||||
| $this->addSql('CREATE TABLE partner_follow (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, partner_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_55FFED0BA76ED395 (user_id), INDEX IDX_55FFED0B9393F8FE (partner_id), UNIQUE INDEX unique_follow (user_id, partner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE partner_follow (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, partner_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_55FFED0BA76ED395 (user_id), INDEX IDX_55FFED0B9393F8FE (partner_id), UNIQUE INDEX unique_follow (user_id, partner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('CREATE TABLE partner_product (id INT AUTO_INCREMENT NOT NULL, partner_id INT NOT NULL, product_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_14A067B09393F8FE (partner_id), INDEX IDX_14A067B04584665A (product_id), UNIQUE INDEX unique_partner_product (partner_id, product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE partner_product (id INT AUTO_INCREMENT NOT NULL, partner_id INT NOT NULL, product_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_14A067B09393F8FE (partner_id), INDEX IDX_14A067B04584665A (product_id), UNIQUE INDEX unique_partner_product (partner_id, product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('CREATE TABLE posting (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, partner_id INT NOT NULL, contact_id INT DEFAULT NULL, sale_id INT DEFAULT NULL, product_id INT NOT NULL, headline VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BD275D737E3C61F9 (owner_id), INDEX IDX_BD275D739393F8FE (partner_id), INDEX IDX_BD275D73E7A1254A (contact_id), INDEX IDX_BD275D734A7E4868 (sale_id), INDEX IDX_BD275D734584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE posting (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, partner_id INT NOT NULL, contact_id INT DEFAULT NULL, sale_id INT DEFAULT NULL, product_id INT NOT NULL, headline VARCHAR(255) NOT NULL, message LONGTEXT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BD275D737E3C61F9 (owner_id), INDEX IDX_BD275D739393F8FE (partner_id), INDEX IDX_BD275D73E7A1254A (contact_id), INDEX IDX_BD275D734A7E4868 (sale_id), INDEX IDX_BD275D734584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, created_by_id INT NOT NULL, navision_id INT UNSIGNED DEFAULT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_D34A04ADB0FD8AF9 (navision_id), INDEX IDX_D34A04AD3DA5256D (image_id), INDEX IDX_D34A04ADB03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE product (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, created_by_id INT NOT NULL, navision_id INT UNSIGNED DEFAULT NULL, name VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_D34A04ADB0FD8AF9 (navision_id), UNIQUE INDEX UNIQ_D34A04AD5E237E06 (name), INDEX IDX_D34A04AD3DA5256D (image_id), INDEX IDX_D34A04ADB03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE sale (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, partner_id INT NOT NULL, product_id INT NOT NULL, turnover INT NOT NULL, profit INT DEFAULT NULL, quantity INT UNSIGNED NOT NULL, comment LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_E54BC0057E3C61F9 (owner_id), INDEX IDX_E54BC0059393F8FE (partner_id), INDEX IDX_E54BC0054584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE sale (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, partner_id INT NOT NULL, product_id INT NOT NULL, turnover INT NOT NULL, profit INT DEFAULT NULL, quantity INT UNSIGNED NOT NULL, comment LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_E54BC0057E3C61F9 (owner_id), INDEX IDX_E54BC0059393F8FE (partner_id), INDEX IDX_E54BC0054584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('CREATE TABLE task (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, assigned_to_id INT NOT NULL, product_id INT NOT NULL, partner_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, due_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', prio VARCHAR(255) NOT NULL, completed TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_527EDB25B03A8386 (created_by_id), INDEX IDX_527EDB25F4BD7827 (assigned_to_id), INDEX IDX_527EDB254584665A (product_id), INDEX IDX_527EDB259393F8FE (partner_id), INDEX IDX_527EDB25E7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE task (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, assigned_to_id INT NOT NULL, product_id INT NOT NULL, partner_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, headline VARCHAR(255) NOT NULL, description LONGTEXT DEFAULT NULL, due_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', prio VARCHAR(255) NOT NULL, completed TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_527EDB25B03A8386 (created_by_id), INDEX IDX_527EDB25F4BD7827 (assigned_to_id), INDEX IDX_527EDB254584665A (product_id), INDEX IDX_527EDB259393F8FE (partner_id), INDEX IDX_527EDB25E7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('CREATE TABLE task_note (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, task_id INT NOT NULL, message LONGTEXT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BC0E6E6F7E3C61F9 (owner_id), INDEX IDX_BC0E6E6F8DB60186 (task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), INDEX IDX_8D93D6493DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE task_note (id INT AUTO_INCREMENT NOT NULL, owner_id INT NOT NULL, task_id INT NOT NULL, message LONGTEXT NOT NULL, type VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_BC0E6E6F7E3C61F9 (owner_id), INDEX IDX_BC0E6E6F8DB60186 (task_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, goals LONGTEXT DEFAULT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), INDEX IDX_8D93D6493DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | |||||
| $this->addSql('CREATE TABLE user_product (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, product_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_8B471AA7A76ED395 (user_id), INDEX IDX_8B471AA74584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | $this->addSql('CREATE TABLE user_product (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, product_id INT NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_8B471AA7A76ED395 (user_id), INDEX IDX_8B471AA74584665A (product_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); | ||||
| $this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526C7E3C61F9 FOREIGN KEY (owner_id) REFERENCES `user` (id)'); | $this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526C7E3C61F9 FOREIGN KEY (owner_id) REFERENCES `user` (id)'); | ||||
| $this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526C9AE985F6 FOREIGN KEY (posting_id) REFERENCES posting (id) ON DELETE CASCADE'); | $this->addSql('ALTER TABLE comment ADD CONSTRAINT FK_9474526C9AE985F6 FOREIGN KEY (posting_id) REFERENCES posting (id) ON DELETE CASCADE'); | ||||
| @@ -65,7 +65,6 @@ class TaskApi | |||||
| #[Assert\NotBlank] | #[Assert\NotBlank] | ||||
| public ?string $headline = null; | public ?string $headline = null; | ||||
| #[Assert\NotBlank] | |||||
| public ?string $description = null; | public ?string $description = null; | ||||
| /** | /** | ||||
| @@ -13,6 +13,7 @@ use ApiPlatform\Metadata\ApiFilter; | |||||
| use ApiPlatform\Metadata\ApiProperty; | use ApiPlatform\Metadata\ApiProperty; | ||||
| use ApiPlatform\Metadata\ApiResource; | use ApiPlatform\Metadata\ApiResource; | ||||
| use App\Entity\TaskNote; | use App\Entity\TaskNote; | ||||
| use App\Enum\TaskNoteContactType; | |||||
| use App\Interface\OwnerInterface; | use App\Interface\OwnerInterface; | ||||
| use App\State\EntityClassDtoStateProcessor; | use App\State\EntityClassDtoStateProcessor; | ||||
| use App\State\EntityToDtoStateProvider; | use App\State\EntityToDtoStateProvider; | ||||
| @@ -75,6 +76,9 @@ class TaskNoteApi implements OwnerInterface | |||||
| #[NotBlank] | #[NotBlank] | ||||
| public ?TaskApi $taskIri = null; | public ?TaskApi $taskIri = null; | ||||
| #[NotBlank] | |||||
| public TaskNoteContactType $type; | |||||
| #[ApiProperty(writable: false)] | #[ApiProperty(writable: false)] | ||||
| public ?\DateTimeImmutable $createdAt = null; | public ?\DateTimeImmutable $createdAt = null; | ||||
| @@ -62,6 +62,8 @@ class UserApi | |||||
| #[Assert\NotBlank] | #[Assert\NotBlank] | ||||
| public ?string $lastName = null; | public ?string $lastName = null; | ||||
| public ?string $goals = null; | |||||
| public ?MediaObject $image = null; | public ?MediaObject $image = null; | ||||
| #[ApiProperty(writable: false)] | #[ApiProperty(writable: false)] | ||||
| @@ -128,9 +128,11 @@ class AppFixtures extends Fixture | |||||
| ); | ); | ||||
| } | } | ||||
| for ($i = 0; $i < 100; $i++) { | |||||
| $numProducts = count(FakeValues::PRODUCTS); | |||||
| for ($i = 0; $i < $numProducts; $i++) { | |||||
| ProductFactory::createOne( | ProductFactory::createOne( | ||||
| [ | [ | ||||
| 'name' => FakeValues::PRODUCTS[$i], | |||||
| 'image' => MediaObjectProductFactory::createOne(), | 'image' => MediaObjectProductFactory::createOne(), | ||||
| 'createdBy' => $adminD | 'createdBy' => $adminD | ||||
| ] | ] | ||||
| @@ -201,7 +201,7 @@ class FakeValues | |||||
| 'SynthoQuanta Elixir', 'NebulaCryo Blend', 'HydroQuell Acid', 'RadiantFusion Serum', 'ElectroCryo-X', 'MolecularQuanta Acid', 'BioSpark Elixir', | 'SynthoQuanta Elixir', 'NebulaCryo Blend', 'HydroQuell Acid', 'RadiantFusion Serum', 'ElectroCryo-X', 'MolecularQuanta Acid', 'BioSpark Elixir', | ||||
| 'QuantumRadiance Blend', 'NanoFlare Acid', 'MagnaQuanta Serum', 'Luminex Catalyst-X', 'CryoFusion Elixir', 'NeuroQuell Blend', 'PlasmaMyst Acid', | 'QuantumRadiance Blend', 'NanoFlare Acid', 'MagnaQuanta Serum', 'Luminex Catalyst-X', 'CryoFusion Elixir', 'NeuroQuell Blend', 'PlasmaMyst Acid', | ||||
| 'SynthoRadiance Serum', 'QuantumVortex-X', 'NebulaSpark Blend', 'HydroGlow Catalyst', 'RadiantQuanta Acid', 'ElectroMyst Elixir', 'MegaQuell Serum', | 'SynthoRadiance Serum', 'QuantumVortex-X', 'NebulaSpark Blend', 'HydroGlow Catalyst', 'RadiantQuanta Acid', 'ElectroMyst Elixir', 'MegaQuell Serum', | ||||
| 'CryoVortex Acid', 'NanoRadiance Blend', 'QuantumFusion Serum', 'SynthoFlare-X', 'PlasmaQuell Acid', 'MolecularGlow Blend', 'Luminex Catalyst-X', | |||||
| 'CryoVortex Acid', 'NanoRadiance Blend', 'QuantumFusion Serum', 'SynthoFlare-X', 'PlasmaQuell Acid', 'MolecularGlow Blend', 'Luminex Catalyst-Z', | |||||
| 'ElectroWave Serum', 'CryoMyst Acid', 'NeuroFusion Elixir', 'NanoSizzle Blend-X', 'QuantumPulse Acid', 'RadiantFlare Serum', 'BioQuanta Catalyst', | 'ElectroWave Serum', 'CryoMyst Acid', 'NeuroFusion Elixir', 'NanoSizzle Blend-X', 'QuantumPulse Acid', 'RadiantFlare Serum', 'BioQuanta Catalyst', | ||||
| ]; | ]; | ||||
| @@ -19,7 +19,7 @@ class Product | |||||
| #[ORM\Column(type: "integer", unique: true, nullable: true, options: ["unsigned" => true])] | #[ORM\Column(type: "integer", unique: true, nullable: true, options: ["unsigned" => true])] | ||||
| protected int $navisionId; | protected int $navisionId; | ||||
| #[ORM\Column(length: 255)] | |||||
| #[ORM\Column(length: 255, unique: true)] | |||||
| private ?string $name = null; | private ?string $name = null; | ||||
| #[ORM\Column(type: Types::TEXT, nullable: true)] | #[ORM\Column(type: Types::TEXT, nullable: true)] | ||||
| @@ -2,6 +2,7 @@ | |||||
| namespace App\Entity; | namespace App\Entity; | ||||
| use App\Enum\TaskNoteContactType; | |||||
| use App\Repository\TaskNoteRepository; | use App\Repository\TaskNoteRepository; | ||||
| use Doctrine\DBAL\Types\Types; | use Doctrine\DBAL\Types\Types; | ||||
| use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
| @@ -25,6 +26,9 @@ class TaskNote | |||||
| #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] | #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] | ||||
| private ?Task $task = null; | private ?Task $task = null; | ||||
| #[ORM\Column(type: 'string', enumType: TaskNoteContactType::class)] | |||||
| private TaskNoteContactType $type; | |||||
| #[ORM\Column] | #[ORM\Column] | ||||
| private ?\DateTimeImmutable $createdAt = null; | private ?\DateTimeImmutable $createdAt = null; | ||||
| @@ -76,6 +80,16 @@ class TaskNote | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getType(): TaskNoteContactType | |||||
| { | |||||
| return $this->type; | |||||
| } | |||||
| public function setType(TaskNoteContactType $type): void | |||||
| { | |||||
| $this->type = $type; | |||||
| } | |||||
| public function getCreatedAt(): ?\DateTimeImmutable | public function getCreatedAt(): ?\DateTimeImmutable | ||||
| { | { | ||||
| return $this->createdAt; | return $this->createdAt; | ||||
| @@ -5,6 +5,7 @@ namespace App\Entity; | |||||
| use App\Repository\UserRepository; | use App\Repository\UserRepository; | ||||
| use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
| use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
| use Doctrine\DBAL\Types\Types; | |||||
| use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
| use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; | use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; | ||||
| use Symfony\Component\Security\Core\User\UserInterface; | use Symfony\Component\Security\Core\User\UserInterface; | ||||
| @@ -31,6 +32,9 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface | |||||
| #[ORM\JoinColumn(nullable: true, onDelete: "SET NULL")] | #[ORM\JoinColumn(nullable: true, onDelete: "SET NULL")] | ||||
| private ?MediaObject $image = null; | private ?MediaObject $image = null; | ||||
| #[ORM\Column(type: Types::TEXT, nullable: true)] | |||||
| private ?string $goals = null; | |||||
| #[ORM\Column] | #[ORM\Column] | ||||
| private array $roles = []; | private array $roles = []; | ||||
| @@ -171,6 +175,16 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface | |||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getGoals(): ?string | |||||
| { | |||||
| return $this->goals; | |||||
| } | |||||
| public function setGoals(?string $goals): void | |||||
| { | |||||
| $this->goals = $goals; | |||||
| } | |||||
| public function getImage(): ?MediaObject | public function getImage(): ?MediaObject | ||||
| { | { | ||||
| return $this->image; | return $this->image; | ||||
| @@ -0,0 +1,15 @@ | |||||
| <?php | |||||
| /** | |||||
| * @author Daniel Knudsen <d.knudsen@spawntree.de> | |||||
| * @date 20.12.23 | |||||
| */ | |||||
| namespace App\Enum; | |||||
| enum TaskNoteContactType: string { | |||||
| case Personal = 'personal'; | |||||
| case Phone = 'phone'; | |||||
| case Email = 'email'; | |||||
| } | |||||
| @@ -48,7 +48,7 @@ final class ProductFactory extends ModelFactory | |||||
| protected function getDefaults(): array | protected function getDefaults(): array | ||||
| { | { | ||||
| return [ | return [ | ||||
| 'name' => self::faker()->randomElement(FakeValues::PRODUCTS), | |||||
| 'name' => self::faker()->word().random_int(1,999999), | |||||
| 'description' => self::faker()->text(), | 'description' => self::faker()->text(), | ||||
| 'createdBy' => UserFactory::random() | 'createdBy' => UserFactory::random() | ||||
| ]; | ]; | ||||
| @@ -3,6 +3,7 @@ | |||||
| namespace App\Factory; | namespace App\Factory; | ||||
| use App\Entity\TaskNote; | use App\Entity\TaskNote; | ||||
| use App\Enum\TaskNoteContactType; | |||||
| use App\Repository\TaskNoteRepository; | use App\Repository\TaskNoteRepository; | ||||
| use Zenstruck\Foundry\ModelFactory; | use Zenstruck\Foundry\ModelFactory; | ||||
| use Zenstruck\Foundry\Proxy; | use Zenstruck\Foundry\Proxy; | ||||
| @@ -51,6 +52,7 @@ final class TaskNoteFactory extends ModelFactory | |||||
| 'message' => self::faker()->text(), | 'message' => self::faker()->text(), | ||||
| 'owner' => UserFactory::random(), | 'owner' => UserFactory::random(), | ||||
| 'task' => TaskFactory::random(), | 'task' => TaskFactory::random(), | ||||
| 'type' => self::faker()->randomElement(TaskNoteContactType::cases()), | |||||
| ]; | ]; | ||||
| } | } | ||||
| @@ -52,6 +52,7 @@ final class UserFactory extends ModelFactory | |||||
| 'email' => self::faker()->email(), | 'email' => self::faker()->email(), | ||||
| 'firstName' => self::faker()->firstName(), | 'firstName' => self::faker()->firstName(), | ||||
| 'lastName' => self::faker()->lastName(), | 'lastName' => self::faker()->lastName(), | ||||
| 'goals' => self::faker()->text(), | |||||
| 'password' => "test", | 'password' => "test", | ||||
| 'roles' => [], | 'roles' => [], | ||||
| ]; | ]; | ||||
| @@ -58,6 +58,7 @@ class TaskNoteApiToEntityMapper implements MapperInterface | |||||
| $entity = $to; | $entity = $to; | ||||
| assert($entity instanceof TaskNote); | assert($entity instanceof TaskNote); | ||||
| $entity->setMessage($dto->message); | $entity->setMessage($dto->message); | ||||
| $entity->setType($dto->type); | |||||
| return $entity; | return $entity; | ||||
| } | } | ||||
| @@ -46,6 +46,8 @@ class TaskNoteEntityToApiMapper implements MapperInterface | |||||
| MicroMapperInterface::MAX_DEPTH => 1, | MicroMapperInterface::MAX_DEPTH => 1, | ||||
| ]); | ]); | ||||
| $dto->type = $entity->getType(); | |||||
| $dto->createdAt = $entity->getCreatedAt(); | $dto->createdAt = $entity->getCreatedAt(); | ||||
| return $dto; | return $dto; | ||||
| @@ -19,7 +19,6 @@ class UserApiToEntityMapper implements MapperInterface | |||||
| public function __construct( | public function __construct( | ||||
| private UserRepository $repository, | private UserRepository $repository, | ||||
| private UserPasswordHasherInterface $userPasswordHasher, | private UserPasswordHasherInterface $userPasswordHasher, | ||||
| private MicroMapperInterface $microMapper, | |||||
| private PropertyAccessorInterface $propertyAccessor, | private PropertyAccessorInterface $propertyAccessor, | ||||
| ) | ) | ||||
| { | { | ||||
| @@ -48,6 +47,7 @@ class UserApiToEntityMapper implements MapperInterface | |||||
| $entity->setEmail($dto->email); | $entity->setEmail($dto->email); | ||||
| $entity->setFirstName($dto->firstName); | $entity->setFirstName($dto->firstName); | ||||
| $entity->setLastName($dto->lastName); | $entity->setLastName($dto->lastName); | ||||
| $entity->setGoals($dto->goals); | |||||
| if ($dto->password) { | if ($dto->password) { | ||||
| $entity->setPassword($this->userPasswordHasher->hashPassword($entity, $dto->password)); | $entity->setPassword($this->userPasswordHasher->hashPassword($entity, $dto->password)); | ||||
| } | } | ||||
| @@ -42,6 +42,7 @@ class UserEntityToApiMapper implements MapperInterface | |||||
| $dto->email = $entity->getEmail(); | $dto->email = $entity->getEmail(); | ||||
| $dto->firstName = $entity->getFirstName(); | $dto->firstName = $entity->getFirstName(); | ||||
| $dto->lastName = $entity->getLastName(); | $dto->lastName = $entity->getLastName(); | ||||
| $dto->goals = $entity->getGoals(); | |||||
| $dto->image = $entity->getImage(); | $dto->image = $entity->getImage(); | ||||
| $dto->imageUrl = $this->fileUrlService->getFileUrl($entity->getImage()); | $dto->imageUrl = $this->fileUrlService->getFileUrl($entity->getImage()); | ||||
| $dto->fullName = $entity->getFirstName() . " " . $entity->getLastName(); | $dto->fullName = $entity->getFirstName() . " " . $entity->getLastName(); | ||||