Add transfer search and OneDrive-style Files storage UI.
Deploy Ladill Transfer / deploy (push) Successful in 29s

Transfers now lists all shares with filters and pagination; Files becomes a selectable cloud view with download, share, delete, move, and open-in-email actions.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-08 20:59:05 +00:00
co-authored by Cursor
parent b36148eeb6
commit 19170d6bc7
15 changed files with 1083 additions and 59 deletions
+113
View File
@@ -0,0 +1,113 @@
<?php
namespace Tests\Feature;
use App\Models\Transfer;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Tests\Concerns\FakesTransferBilling;
use Tests\TestCase;
class TransferFilesTest extends TestCase
{
use FakesTransferBilling;
use RefreshDatabase;
private function createTransfer(User $user, string $title, string $filename): Transfer
{
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => $title,
'files' => [UploadedFile::fake()->create($filename, 50, 'application/pdf')],
])->assertRedirect();
return Transfer::query()->where('title', $title)->firstOrFail();
}
public function test_owner_can_download_file(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$transfer = $this->createTransfer($user, 'Docs', 'brief.pdf');
$file = $transfer->files()->first();
$this->actingAs($user)
->get(route('transfer.files.download', $file))
->assertOk();
}
public function test_owner_can_delete_file(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$transfer = $this->createTransfer($user, 'Docs', 'brief.pdf');
$file = $transfer->files()->first();
$this->actingAs($user)
->delete(route('transfer.files.destroy', $file))
->assertRedirect();
$this->assertDatabaseMissing('transfer_files', ['id' => $file->id]);
}
public function test_owner_can_move_file_to_another_transfer(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$source = $this->createTransfer($user, 'Source folder', 'one.pdf');
$destination = $this->createTransfer($user, 'Destination folder', 'two.pdf');
$file = $source->files()->first();
$this->actingAs($user)
->post(route('transfer.files.move'), [
'destination' => $destination->id,
'files' => [$file->id],
])
->assertRedirect(route('transfer.files.index', ['folder' => $destination->id]));
$this->assertSame($destination->id, $file->fresh()->transfer_id);
}
public function test_files_index_supports_folder_filter(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$transfer = $this->createTransfer($user, 'BKC', 'cover.psd');
$this->actingAs($user)
->get(route('transfer.files.index', ['folder' => $transfer->id]))
->assertOk()
->assertSee('cover.psd')
->assertSee('BKC');
}
}
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace Tests\Feature;
use App\Models\Transfer;
use App\Models\TransferFile;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Tests\Concerns\FakesTransferBilling;
use Tests\TestCase;
class TransferSearchTest extends TestCase
{
use FakesTransferBilling;
use RefreshDatabase;
public function test_transfers_index_can_be_searched(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Marketing assets',
'files' => [UploadedFile::fake()->create('logo.png', 50, 'image/png')],
])->assertRedirect();
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Finance reports',
'files' => [UploadedFile::fake()->create('report.pdf', 50, 'application/pdf')],
])->assertRedirect();
$this->actingAs($user)
->get(route('transfer.transfers.index', ['q' => 'Marketing']))
->assertOk()
->assertSee('Marketing assets')
->assertDontSee('Finance reports');
}
public function test_global_search_returns_transfers_and_files(): void
{
Storage::fake('qr');
$this->fakeTransferBillingApi();
$user = User::create([
'public_id' => (string) Str::uuid(),
'name' => 'Test User',
'email' => 'transfer+'.uniqid().'@example.com',
]);
$this->actingAs($user)->post(route('transfer.transfers.store'), [
'title' => 'Brand kit',
'files' => [UploadedFile::fake()->create('cover.psd', 50, 'application/octet-stream')],
])->assertRedirect();
$response = $this->actingAs($user)
->getJson(route('transfer.search', ['q' => 'cover']))
->assertOk();
$results = $response->json('results');
$this->assertNotEmpty($results);
$this->assertTrue(collect($results)->contains(fn ($item) => $item['type'] === 'file'));
}
}