|
@@ -30,7 +30,6 @@ use Ramsey\Uuid\Uuid;
|
|
|
class UploadRequest
|
|
class UploadRequest
|
|
|
{
|
|
{
|
|
|
/**
|
|
/**
|
|
|
- * Only because id is required
|
|
|
|
|
* @var int | null
|
|
* @var int | null
|
|
|
*/
|
|
*/
|
|
|
#[ApiProperty(identifier: true)]
|
|
#[ApiProperty(identifier: true)]
|
|
@@ -43,7 +42,7 @@ class UploadRequest
|
|
|
private string $filename;
|
|
private string $filename;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * The content of the uploaded file
|
|
|
|
|
|
|
+ * Le contenu du fichier uploadé encodé au format Base64
|
|
|
* @var string
|
|
* @var string
|
|
|
*/
|
|
*/
|
|
|
private string $content;
|
|
private string $content;
|
|
@@ -57,9 +56,10 @@ class UploadRequest
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Le type de fichier uploadé, si connu
|
|
* Le type de fichier uploadé, si connu
|
|
|
- * @var FileTypeEnum
|
|
|
|
|
|
|
+ * @var string
|
|
|
*/
|
|
*/
|
|
|
- private FileTypeEnum $type;
|
|
|
|
|
|
|
+ #[Assert\Choice(callback: [FileTypeEnum::class, 'toArray'])]
|
|
|
|
|
+ private string $type = "NONE";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Visibilité du fichier
|
|
* Visibilité du fichier
|
|
@@ -73,9 +73,15 @@ class UploadRequest
|
|
|
*/
|
|
*/
|
|
|
private ?string $mimeType = null;
|
|
private ?string $mimeType = null;
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Configuration du fichier (par exemple le cropping d'une image)
|
|
|
|
|
+ * @var string
|
|
|
|
|
+ */
|
|
|
|
|
+ private ?string $config = null;
|
|
|
|
|
+
|
|
|
public function __construct()
|
|
public function __construct()
|
|
|
{
|
|
{
|
|
|
- $this->type = FileTypeEnum::NONE();
|
|
|
|
|
|
|
+ $this->type = FileTypeEnum::NONE()->getValue();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -150,18 +156,18 @@ class UploadRequest
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @return FileTypeEnum
|
|
|
|
|
|
|
+ * @return string
|
|
|
*/
|
|
*/
|
|
|
- public function getType(): FileTypeEnum
|
|
|
|
|
|
|
+ public function getType(): string
|
|
|
{
|
|
{
|
|
|
return $this->type;
|
|
return $this->type;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * @param FileTypeEnum $type
|
|
|
|
|
|
|
+ * @param string $type
|
|
|
* @return self
|
|
* @return self
|
|
|
*/
|
|
*/
|
|
|
- public function setType(FileTypeEnum $type): self
|
|
|
|
|
|
|
+ public function setType(string $type): self
|
|
|
{
|
|
{
|
|
|
$this->type = $type;
|
|
$this->type = $type;
|
|
|
return $this;
|
|
return $this;
|
|
@@ -202,4 +208,22 @@ class UploadRequest
|
|
|
$this->mimeType = $mimeType;
|
|
$this->mimeType = $mimeType;
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @return string|null
|
|
|
|
|
+ */
|
|
|
|
|
+ public function getConfig(): ?string
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->config;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param string|null $config
|
|
|
|
|
+ * @return self
|
|
|
|
|
+ */
|
|
|
|
|
+ public function setConfig(?string $config): self
|
|
|
|
|
+ {
|
|
|
|
|
+ $this->config = $config;
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|