diff --git a/app/Http/Requests/Maintenance/FullTreeUpdateRequest.php b/app/Http/Requests/Maintenance/FullTreeUpdateRequest.php index e0a8582c849..c0a134ffa4c 100644 --- a/app/Http/Requests/Maintenance/FullTreeUpdateRequest.php +++ b/app/Http/Requests/Maintenance/FullTreeUpdateRequest.php @@ -11,7 +11,7 @@ use App\Http\Requests\BaseApiRequest; use App\Models\Configs; use App\Policies\SettingsPolicy; -use App\Rules\AlbumIDRule; +use App\Rules\RandomIDRule; use Illuminate\Support\Facades\Gate; class FullTreeUpdateRequest extends BaseApiRequest @@ -34,10 +34,10 @@ public function rules(): array return [ 'albums' => 'required|array|min:1', 'albums.*' => 'required|array', - 'albums.*.id' => ['required', new AlbumIDRule(false)], + 'albums.*.id' => ['required', new RandomIDRule(false)], 'albums.*._lft' => 'required|integer|min:1', 'albums.*._rgt' => 'required|integer|min:1', - 'albums.*.parent_id' => [new AlbumIDRule(true)], + 'albums.*.parent_id' => [new RandomIDRule(true)], ]; } diff --git a/tests/Feature_v2/Maintenance/CleaningTest.php b/tests/Feature_v2/Maintenance/CleaningTest.php index 223a6e51e4a..d3ad5b4efb3 100644 --- a/tests/Feature_v2/Maintenance/CleaningTest.php +++ b/tests/Feature_v2/Maintenance/CleaningTest.php @@ -18,6 +18,7 @@ namespace Tests\Feature_v2\Maintenance; +use function Safe\mkdir; use function Safe\touch; use Tests\Feature_v2\Base\BaseApiV2Test; diff --git a/tests/Feature_v2/Maintenance/FullTreeTest.php b/tests/Feature_v2/Maintenance/FullTreeTest.php index 95b01b09722..b9bb72a0fa0 100644 --- a/tests/Feature_v2/Maintenance/FullTreeTest.php +++ b/tests/Feature_v2/Maintenance/FullTreeTest.php @@ -30,10 +30,10 @@ public function testGuest(): void $response = $this->postJson('Maintenance::fullTree', []); $this->assertUnprocessable($response); - $response = $this->putJson('Maintenance::fullTree', [ + $response = $this->postJson('Maintenance::fullTree', [ 'albums' => [ [ - 'id' => '1', + 'id' => '123456789012345678901234', '_lft' => 1, '_rgt' => 2, 'parent_id' => null, @@ -51,10 +51,10 @@ public function testUser(): void $response = $this->actingAs($this->userLocked)->postJson('Maintenance::fullTree', []); $this->assertUnprocessable($response); - $response = $this->actingAs($this->userLocked)->putJson('Maintenance::fullTree', [ + $response = $this->actingAs($this->userLocked)->postJson('Maintenance::fullTree', [ 'albums' => [ [ - 'id' => '1', + 'id' => '123456789012345678901234', '_lft' => 1, '_rgt' => 2, 'parent_id' => null,