remove legacy pdf path

This commit is contained in:
Yisroel Baum 2026-06-20 22:50:10 +03:00
parent 28f4114def
commit b280475314
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 2 additions and 65 deletions

View file

@ -72,7 +72,6 @@ class ElementController
richText: $this->stringInput($request, 'richText'),
shortPdfPath: $this->stringInput($request, 'shortPdfPath'),
longPdfPath: $this->stringInput($request, 'longPdfPath'),
pdfPath: $this->stringInput($request, 'pdfPath'),
youtubeUrl: $this->stringInput($request, 'youtubeUrl'),
fileType: $this->stringInput($request, 'fileType'),
fileContents: $file['contents'],
@ -176,7 +175,6 @@ class ElementController
* richText: string,
* shortPdfPath: string|null,
* longPdfPath: string|null,
* pdfPath: string|null,
* youtubeUrl: string|null,
* }
*/
@ -199,10 +197,6 @@ class ElementController
$element->getLongPdfPath(),
'element-pdfs/',
),
'pdfPath' => $this->storageUrl(
$element->getShortPdfPath(),
'element-pdfs/',
),
'youtubeUrl' => $element->getYoutubeUrl(),
];
}

View file

@ -46,7 +46,6 @@ class UpdateElement
&& $request->richText === null
&& $request->shortPdfPath === null
&& $request->longPdfPath === null
&& $request->pdfPath === null
&& $request->youtubeUrl === null
&& $request->fileType === null
&& $request->fileContents === null
@ -88,11 +87,6 @@ class UpdateElement
id: $request->id,
shortPdfPath: $request->shortPdfPath,
));
} elseif ($request->pdfPath !== null) {
$this->updateShortPdfPath->execute(new UpdateShortPdfPathRequest(
id: $request->id,
shortPdfPath: $request->pdfPath,
));
}
if ($request->longPdfPath !== null) {
$this->updateLongPdfPath->execute(new UpdateLongPdfPathRequest(

View file

@ -12,7 +12,6 @@ class UpdateElementRequest
public ?string $richText,
public ?string $shortPdfPath,
public ?string $longPdfPath,
public ?string $pdfPath,
public ?string $youtubeUrl,
public ?string $fileType,
public ?string $fileContents,

View file

@ -191,7 +191,7 @@ class GetElementTest extends TestCase
string $description,
?string $iconImageUrl,
string $richText,
?string $pdfPath,
?string $shortPdfPath,
?string $youtubeUrl,
?Element $parentElement,
): Element {
@ -201,7 +201,7 @@ class GetElementTest extends TestCase
description: $description,
iconImageUrl: $iconImageUrl,
richText: $richText,
shortPdfPath: $pdfPath,
shortPdfPath: $shortPdfPath,
longPdfPath: null,
youtubeUrl: $youtubeUrl,
parentElement: $parentElement,

View file

@ -83,7 +83,6 @@ class UpdateElementTest extends TestCase
richText: '<p>Updated rich text</p>',
shortPdfPath: '/assets/pdfs/updated.pdf',
longPdfPath: '/assets/pdfs/updated-long.pdf',
pdfPath: null,
youtubeUrl: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
fileType: null,
fileContents: null,
@ -125,42 +124,6 @@ class UpdateElementTest extends TestCase
$this->assertSame('Updated title', $persistedElement->getTitle());
}
public function testLegacyPdfPathIsNotAnUpdateField(): void
{
$set = $this->createSet(1, 'Baderech');
$element = $this->createElement(
$set,
'Original title',
'Original description',
null,
'<p>Original rich text</p>',
'/assets/pdfs/original.pdf',
'/assets/pdfs/original-long.pdf',
null,
null,
);
$this->expectException(BadRequestException::class);
$this->expectExceptionMessage('nothing to update');
$this->updateElement->execute(new UpdateElementRequest(
id: $element->getId(),
title: null,
description: null,
iconImageUrl: null,
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: '/assets/pdfs/legacy-updated.pdf',
youtubeUrl: null,
fileType: null,
fileContents: null,
fileOriginalName: null,
fileMimeType: null,
fileSizeBytes: null,
));
}
public function testConvertsEmptyNullableFieldsToNull(): void
{
$set = $this->createSet(1, 'Baderech');
@ -185,7 +148,6 @@ class UpdateElementTest extends TestCase
richText: '<p>Updated rich text</p>',
shortPdfPath: '',
longPdfPath: '',
pdfPath: null,
youtubeUrl: '',
fileType: null,
fileContents: null,
@ -225,7 +187,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: null,
@ -285,7 +246,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: 'iconImage',
fileContents: 'binary-image-bytes',
@ -301,7 +261,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: 'shortPdf',
fileContents: 'binary-short-pdf-bytes',
@ -318,7 +277,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: 'longPdf',
fileContents: 'binary-long-pdf-bytes',
@ -367,7 +325,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: 'binary-image-bytes',
@ -390,7 +347,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: 'audio',
fileContents: 'binary-audio-bytes',
@ -413,7 +369,6 @@ class UpdateElementTest extends TestCase
richText: '<p>Updated rich text</p>',
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: null,
@ -436,7 +391,6 @@ class UpdateElementTest extends TestCase
richText: null,
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: null,
@ -459,7 +413,6 @@ class UpdateElementTest extends TestCase
richText: '<p>Updated rich text</p>',
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: null,
@ -482,7 +435,6 @@ class UpdateElementTest extends TestCase
richText: '<p>Updated rich text</p>',
shortPdfPath: null,
longPdfPath: null,
pdfPath: null,
youtubeUrl: null,
fileType: null,
fileContents: null,

View file

@ -12,7 +12,6 @@ export interface Element extends ChildElement {
richText: string
shortPdfPath: string | null
longPdfPath: string | null
pdfPath: string | null
youtubeUrl: string | null
}
@ -41,7 +40,6 @@ interface ElementPatchInput {
richText?: string
shortPdfPath?: string
longPdfPath?: string
pdfPath?: string
youtubeUrl?: string
}