Преглед на файлове

minor fixes; enable SSE for hello profile resource

Olivier Massot преди 2 месеца
родител
ревизия
55ad9248f5

+ 1 - 1
src/ApiResources/Dolibarr/DolibarrDocDownload.php

@@ -36,7 +36,7 @@ class DolibarrDocDownload
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    protected int $id = 0;
+    protected int $id = 1;
 
     /**
      * Type de fichier à télécharger.

+ 1 - 1
src/ApiResources/Export/ExportRequest.php

@@ -19,7 +19,7 @@ abstract class ExportRequest
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    protected int $id = 0;
+    protected int $id = 1;
 
     /**
      * Format de sortie attendu (pdf, txt...).

+ 1 - 1
src/ApiResources/HelloAsso/AuthUrl.php

@@ -28,7 +28,7 @@ class AuthUrl
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     /**
      * URL d'authentification HelloAsso pour l'autorisation OAuth2.

+ 1 - 1
src/ApiResources/HelloAsso/ConnectionRequest.php

@@ -28,7 +28,7 @@ class ConnectionRequest implements ApiResourcesInterface
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     private int $organizationId;
 

+ 1 - 1
src/ApiResources/HelloAsso/HelloAssoProfile.php

@@ -29,7 +29,7 @@ class HelloAssoProfile
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     /**
      * Is there a HelloAsso profile linked to this organization ?

+ 1 - 1
src/ApiResources/Organization/OrganizationCreationRequest.php

@@ -39,7 +39,7 @@ class OrganizationCreationRequest
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     /**
      * A quelle adresse email notifier la création de l'organisation, ou d'éventuelles erreurs ?

+ 1 - 1
src/ApiResources/Organization/OrganizationDeletionRequest.php

@@ -32,7 +32,7 @@ class OrganizationDeletionRequest
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     private int $organizationId;
 

+ 1 - 1
src/ApiResources/Organization/Subdomain/SubdomainAvailability.php

@@ -30,7 +30,7 @@ class SubdomainAvailability
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    protected int $id = 0;
+    protected int $id = 1;
 
     /**
      * The subdomain.

+ 1 - 1
src/ApiResources/Shop/NewStructureArtistPremiumTrialRequest.php

@@ -39,7 +39,7 @@ class NewStructureArtistPremiumTrialRequest implements ShopRequestData
      * de l'IRI par api platform.
      */
     #[ApiProperty(identifier: true)]
-    private int $id = 0;
+    private int $id = 1;
 
     #[Assert\Length(
         min: 2,

+ 7 - 1
src/State/Processor/HelloAsso/ConnectionRequestProcessor.php

@@ -12,6 +12,7 @@ use App\ApiResources\HelloAsso\HelloAssoProfile;
 use App\Entity\Access\Access;
 use App\Entity\Organization\HelloAsso;
 use App\Service\HelloAsso\ConnectionService;
+use App\Service\MercureHub;
 use http\Client\Response;
 use Symfony\Bundle\SecurityBundle\Security;
 use Symfony\Component\HttpFoundation\RedirectResponse;
@@ -24,6 +25,7 @@ class ConnectionRequestProcessor implements ProcessorInterface
     public function __construct(
         private readonly ConnectionService $connectionService,
         private Security $security,
+        private MercureHub $mercureHub,
     ) {
     }
 
@@ -52,11 +54,15 @@ class ConnectionRequestProcessor implements ProcessorInterface
             throw new \RuntimeException('Forbidden');
         }
 
-        $this->connectionService->connect(
+        $helloAssoEntity = $this->connectionService->connect(
             $connectionRequest->getOrganizationId(),
             $connectionRequest->getAuthorizationCode()
         );
 
+        $helloAssoProfile = $this->connectionService->makeHelloAssoProfile($connectionRequest->getOrganizationId());
+
+        $this->mercureHub->publishUpdate($access->getId(), $helloAssoProfile);
+
         return $connectionRequest;
     }
 }