Forráskód Böngészése

complete OrganizationCreationRequest api resource

Olivier Massot 1 éve
szülő
commit
202bfd075a

+ 236 - 3
src/ApiResources/Organization/OrganizationCreationRequest.php

@@ -5,13 +5,16 @@ namespace App\ApiResources\Organization;
 use ApiPlatform\Metadata\ApiProperty;
 use ApiPlatform\Metadata\ApiResource;
 use ApiPlatform\Metadata\Post;
-use App\State\Processor\Export\LicenceCmf\ExportRequestProcessor;
+use App\Enum\Organization\LegalEnum;
+use App\Enum\Organization\PrincipalTypeEnum;
+use App\Enum\Organization\SettingsProductEnum;
+use App\State\Processor\Organization\OrganizationCreationRequestProcessor;
 
 #[ApiResource(
     operations: [
         new Post(
             uriTemplate: '/internal/organization/create',
-            security: 'false'
+            security: 'user.getSuperAdminAccess()'
         ),
     ],
     processor: OrganizationCreationRequestProcessor::class
@@ -23,7 +26,237 @@ class OrganizationCreationRequest
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    protected int $id = 0;
+    private int $id = 0;
 
+    private string $name;
 
+    private LegalEnum $legalStatus;
+
+    private SettingsProductEnum $product;
+
+    private string $streetAddress1;
+
+    private ?string $streetAddress2 = null;
+
+    private ?string $streetAddress3 = null;
+
+    private string $postalCode;
+
+    private string $city;
+
+    private int $countryId = 72; // France's id
+
+    private string $phoneNumber;
+
+    private string $email;
+
+    private string $subdomain;
+
+    private int $parentId;
+
+    private int $network;
+
+    private PrincipalTypeEnum $principalType;
+
+    private ?OrganizationMemberCreationRequest $president = null;
+
+    private ?OrganizationMemberCreationRequest $director = null;
+
+    public function getId(): int
+    {
+        return $this->id;
+    }
+
+    public function setId(int $id): self
+    {
+        $this->id = $id;
+        return $this;
+    }
+
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    public function setName(string $name): self
+    {
+        $this->name = $name;
+        return $this;
+    }
+
+    public function getLegalStatus(): LegalEnum
+    {
+        return $this->legalStatus;
+    }
+
+    public function setLegalStatus(LegalEnum $legalStatus): self
+    {
+        $this->legalStatus = $legalStatus;
+        return $this;
+    }
+
+    public function getProduct(): SettingsProductEnum
+    {
+        return $this->product;
+    }
+
+    public function setProduct(SettingsProductEnum $product): self
+    {
+        $this->product = $product;
+        return $this;
+    }
+
+    public function getStreetAddress1(): string
+    {
+        return $this->streetAddress1;
+    }
+
+    public function setStreetAddress1(string $streetAddress1): self
+    {
+        $this->streetAddress1 = $streetAddress1;
+        return $this;
+    }
+
+    public function getStreetAddress2(): ?string
+    {
+        return $this->streetAddress2;
+    }
+
+    public function setStreetAddress2(?string $streetAddress2): self
+    {
+        $this->streetAddress2 = $streetAddress2;
+        return $this;
+    }
+
+    public function getStreetAddress3(): ?string
+    {
+        return $this->streetAddress3;
+    }
+
+    public function setStreetAddress3(?string $streetAddress3): self
+    {
+        $this->streetAddress3 = $streetAddress3;
+        return $this;
+    }
+
+    public function getPostalCode(): string
+    {
+        return $this->postalCode;
+    }
+
+    public function setPostalCode(string $postalCode): self
+    {
+        $this->postalCode = $postalCode;
+        return $this;
+    }
+
+    public function getCity(): string
+    {
+        return $this->city;
+    }
+
+    public function setCity(string $city): self
+    {
+        $this->city = $city;
+        return $this;
+    }
+
+    public function getCountryId(): int
+    {
+        return $this->countryId;
+    }
+
+    public function setCountryId(int $countryId): self
+    {
+        $this->countryId = $countryId;
+        return $this;
+    }
+
+    public function getPhoneNumber(): string
+    {
+        return $this->phoneNumber;
+    }
+
+    public function setPhoneNumber(string $phoneNumber): self
+    {
+        $this->phoneNumber = $phoneNumber;
+        return $this;
+    }
+
+    public function getEmail(): string
+    {
+        return $this->email;
+    }
+
+    public function setEmail(string $email): self
+    {
+        $this->email = $email;
+        return $this;
+    }
+
+    public function getSubdomain(): string
+    {
+        return $this->subdomain;
+    }
+
+    public function setSubdomain(string $subdomain): self
+    {
+        $this->subdomain = $subdomain;
+        return $this;
+    }
+
+    public function getParentId(): int
+    {
+        return $this->parentId;
+    }
+
+    public function setParentId(int $parentId): self
+    {
+        $this->parentId = $parentId;
+        return $this;
+    }
+
+    public function getNetwork(): int
+    {
+        return $this->network;
+    }
+
+    public function setNetwork(int $network): self
+    {
+        $this->network = $network;
+        return $this;
+    }
+
+    public function getPrincipalType(): PrincipalTypeEnum
+    {
+        return $this->principalType;
+    }
+
+    public function setPrincipalType(PrincipalTypeEnum $principalType): self
+    {
+        $this->principalType = $principalType;
+        return $this;
+    }
+
+    public function getPresident(): ?OrganizationMemberCreationRequest
+    {
+        return $this->president;
+    }
+
+    public function setPresident(?OrganizationMemberCreationRequest $president): self
+    {
+        $this->president = $president;
+        return $this;
+    }
+
+    public function getDirector(): ?OrganizationMemberCreationRequest
+    {
+        return $this->director;
+    }
+
+    public function setDirector(?OrganizationMemberCreationRequest $director): self
+    {
+        $this->director = $director;
+        return $this;
+    }
 }

+ 136 - 0
src/ApiResources/Organization/OrganizationMemberCreationRequest.php

@@ -0,0 +1,136 @@
+<?php
+
+namespace App\ApiResources\Organization;
+
+class OrganizationMemberCreationRequest
+{
+    private string $name;
+
+    private string $streetAddress1;
+
+    private string $streetAddress2;
+
+    private string $streetAddress3;
+
+    private string $postalCode;
+
+    private string $city;
+
+    private int $countryId = 72; // France's id
+
+    private string $phone;
+
+    private string $mobile;
+
+    private string $email;
+
+    public function getName(): string
+    {
+        return $this->name;
+    }
+
+    public function setName(string $name): self
+    {
+        $this->name = $name;
+        return $this;
+    }
+
+    public function getStreetAddress1(): string
+    {
+        return $this->streetAddress1;
+    }
+
+    public function setStreetAddress1(string $streetAddress1): self
+    {
+        $this->streetAddress1 = $streetAddress1;
+        return $this;
+    }
+
+    public function getStreetAddress2(): string
+    {
+        return $this->streetAddress2;
+    }
+
+    public function setStreetAddress2(string $streetAddress2): self
+    {
+        $this->streetAddress2 = $streetAddress2;
+        return $this;
+    }
+
+    public function getStreetAddress3(): string
+    {
+        return $this->streetAddress3;
+    }
+
+    public function setStreetAddress3(string $streetAddress3): self
+    {
+        $this->streetAddress3 = $streetAddress3;
+        return $this;
+    }
+
+    public function getPostalCode(): string
+    {
+        return $this->postalCode;
+    }
+
+    public function setPostalCode(string $postalCode): self
+    {
+        $this->postalCode = $postalCode;
+        return $this;
+    }
+
+    public function getCity(): string
+    {
+        return $this->city;
+    }
+
+    public function setCity(string $city): self
+    {
+        $this->city = $city;
+        return $this;
+    }
+
+    public function getCountryId(): int
+    {
+        return $this->countryId;
+    }
+
+    public function setCountryId(int $countryId): self
+    {
+        $this->countryId = $countryId;
+        return $this;
+    }
+
+    public function getPhone(): string
+    {
+        return $this->phone;
+    }
+
+    public function setPhone(string $phone): self
+    {
+        $this->phone = $phone;
+        return $this;
+    }
+
+    public function getMobile(): string
+    {
+        return $this->mobile;
+    }
+
+    public function setMobile(string $mobile): self
+    {
+        $this->mobile = $mobile;
+        return $this;
+    }
+
+    public function getEmail(): string
+    {
+        return $this->email;
+    }
+
+    public function setEmail(string $email): self
+    {
+        $this->email = $email;
+        return $this;
+    }
+}