file upload
This commit is contained in:
@@ -57,6 +57,9 @@ readonly class RecordService
|
||||
throw new LucentException("You can't upload a file to a regular record");
|
||||
}
|
||||
$fileData = $this->fileService->createFromUrl($schema, $url);
|
||||
if ($fileData->isDuplicate) {
|
||||
return $fileData->duplicateId;
|
||||
}
|
||||
return $this->create($data, $fileData->recordFile, $edges);
|
||||
}
|
||||
|
||||
@@ -64,13 +67,16 @@ readonly class RecordService
|
||||
UploadedFile $uploadedFile,
|
||||
RecordInputData $data,
|
||||
array $edges
|
||||
)
|
||||
): string
|
||||
{
|
||||
$schema = $this->channelService->getSchema($data->schemaName)->get();
|
||||
if ($schema->type !== Type::FILES) {
|
||||
throw new LucentException("You can't upload a file to a regular record");
|
||||
}
|
||||
$fileData = $this->fileService->upload($schema, $uploadedFile);
|
||||
if ($fileData->isDuplicate) {
|
||||
return $fileData->duplicateId;
|
||||
}
|
||||
return $this->create($data, $fileData->recordFile, $edges);
|
||||
}
|
||||
|
||||
@@ -78,7 +84,7 @@ readonly class RecordService
|
||||
FileData $fileData,
|
||||
RecordInputData $data,
|
||||
array $edges
|
||||
)
|
||||
): string
|
||||
{
|
||||
$schema = $this->channelService->getSchema($data->schemaName)->get();
|
||||
if ($schema->type !== Type::FILES) {
|
||||
|
||||
Reference in New Issue
Block a user