Pārlūkot izejas kodu

public events: imageId becomes imageUrl and thumbnailUrl

Olivier Massot 3 gadi atpakaļ
vecāks
revīzija
08c08f0cfd

+ 5 - 3
sql/schema-extensions/001-view_public_events.sql

@@ -6,7 +6,9 @@ AS
         ap.addressCity AS city, ap.postalCode,
         TRIM(BOTH ' ' FROM CONCAT( if(ap.streetAddress is null,'',ap.streetAddress), ' ', if(ap.streetAddressSecond is null,'',ap.streetAddressSecond), ' ', if(ap.streetAddressThird is null,'',ap.streetAddressThird))) AS streetAddress,
         ap.longitude, ap.latitude,
-        r.name AS roomName, r.description AS roomDescription, r.localisation AS roomLocalisation, r.capacity AS roomCapacity, r.floorSize AS roomFloorSize, b.image_id AS imageId,
+        r.name AS roomName, r.description AS roomDescription, r.localisation AS roomLocalisation, r.capacity AS roomCapacity, r.floorSize AS roomFloorSize,
+        If(b.image_id is not null, CONCAT('https://api.opentalent.fr/app.php/_internal/secure/files/', b.image_id, '/raw'), null) AS imageUrl,
+        If(b.image_id is not null, CONCAT('https://api.opentalent.fr/app.php/_internal/secure/files/', b.image_id, '/0x120'), null) AS thumbnailUrl,
         (SELECT GROUP_CONCAT(CONCAT(f.code))
          FROM event_categories AS ec
             LEFT JOIN Categories AS cs ON(cs.id = ec.categories_id)
@@ -22,11 +24,11 @@ AS
     WHERE b.discr = 'event' AND b.datetimeEnd >= NOW() AND b.visibility = 'PUBLIC_VISIBILITY' AND b.isCanceled = 0
 UNION
     SELECT
-        aw.uuid, null AS organizationId, aw.name, aw.description, NULL AS url, aw.datetimeStart, aw.datetimeEnd,
+        aw.uuid, null AS organizationId, aw.name, aw.description, aw.deepLink AS url, aw.datetimeStart, aw.datetimeEnd,
         aw.place AS placeName, NULL AS placeDescription, NULL AS placeFloorSize, NULL AS placeCapacity,
         aw.city, aw.postalCode, aw.streetAddress, aw.longitude, aw.latitude,
         NULL AS roomName, NULL AS roomDescription, NULL AS roomLocalisation, NULL AS roomCapacity, NULL AS roomFloorSize,
-        aw.largeimage AS imageId, aw.categories AS categories, 'awin' as origin, aw.id as entityId
+        aw.largeimage AS imageUrl, aw.mediumimage as thumbnailUrl, aw.categories AS categories, 'awin' as origin, aw.id as entityId
     FROM  AwinProduct as aw
     WHERE
         aw.datetimeEnd >= NOW() AND aw.datetimeStart IS NOT NULL;

+ 29 - 8
src/Entity/Public/PublicEvent.php

@@ -93,8 +93,11 @@ class PublicEvent
     #[ORM\Column]
     private ?string $roomFloorSize;
 
-    #[ORM\Column(type: 'integer')]
-    private ?int $imageId;
+    #[ORM\Column]
+    private ?string $imageUrl;
+
+    #[ORM\Column]
+    private ?string $thumbnailUrl;
 
     #[ORM\Column(type: 'simple_array')]
     private ?array $categories;
@@ -412,20 +415,38 @@ class PublicEvent
     }
 
     /**
-     * @return int|null
+     * @return string|null
+     */
+    public function getImageUrl(): ?string
+    {
+        return $this->imageUrl;
+    }
+
+    /**
+     * @param string|null $imageUrl
+     * @return PublicEvent
+     */
+    public function setImageUrl(?string $imageUrl): self
+    {
+        $this->imageUrl = $imageUrl;
+        return $this;
+    }
+
+    /**
+     * @return string|null
      */
-    public function getImageId(): ?int
+    public function getThumbnailUrl(): ?string
     {
-        return $this->imageId;
+        return $this->thumbnailUrl;
     }
 
     /**
-     * @param int|null $imageId
+     * @param string|null $thumbnailUrl
      * @return PublicEvent
      */
-    public function setImageId(?int $imageId): self
+    public function setThumbnailUrl(?string $thumbnailUrl): self
     {
-        $this->imageId = $imageId;
+        $this->thumbnailUrl = $thumbnailUrl;
         return $this;
     }