feat(admin): IP pool allocation, billing exports, service attachments
- IP pool: sheet import (xlsx/csv) matched by address, bulk allocate/revoke with notification email (ip_allocated/ip_revoked), ip_pool_logs history. - Orders/invoices: Excel export on branded template (BrandedReportWriter), shared billing filters, order item service info in list responses. - Web design quote Excel export; activity log export. - Service attachments with copy-to-invoice; deployment invoice attachments. - Customer email attachments stored on disk and attached by path. - Admin password change endpoint; user.fullname backfill migration; orders.user_id backfill from logs. - Disable deploy workflow until CI/CD is set up. - Ignore stored customer email and service attachment uploads. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ea5697cb81
commit
46aa138eec
@@ -10,7 +10,9 @@ use App\Models\Customer;
|
||||
use App\Models\Template;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -158,4 +160,36 @@ class SendTemplateEmailTest extends TestCase
|
||||
|
||||
$this->assertDatabaseMissing('mail', ['customer_id' => $this->customer->id]);
|
||||
}
|
||||
|
||||
public function test_send_attaches_uploaded_files(): void
|
||||
{
|
||||
Mail::fake();
|
||||
Storage::fake('local');
|
||||
$base = "/api/v1/administrator/customers/{$this->customer->uuid}/send-email";
|
||||
|
||||
$this->actingAs($this->admin, 'admin')
|
||||
->post($base, [
|
||||
'subject' => 'Hợp đồng',
|
||||
'message' => '<p>Gửi hợp đồng</p>',
|
||||
'to' => $this->customer->email,
|
||||
'attachments' => [
|
||||
UploadedFile::fake()->create('hop-dong.pdf', 100, 'application/pdf'),
|
||||
UploadedFile::fake()->create('phu-luc.docx', 50),
|
||||
],
|
||||
], ['Accept' => 'application/json'])
|
||||
->assertOk();
|
||||
|
||||
Mail::assertQueued(ManualCustomerEmail::class, function (ManualCustomerEmail $mail) {
|
||||
$names = array_map(fn ($attachment) => $attachment->as, $mail->attachments());
|
||||
|
||||
return $names === ['hop-dong.pdf', 'phu-luc.docx'];
|
||||
});
|
||||
$this->assertCount(2, Storage::disk('local')->allFiles("customer-emails/{$this->customer->id}"));
|
||||
|
||||
$this->post($base, [
|
||||
'subject' => 'Hợp đồng',
|
||||
'message' => '<p>Gửi hợp đồng</p>',
|
||||
'attachments' => [UploadedFile::fake()->create('script.php', 1)],
|
||||
], ['Accept' => 'application/json'])->assertStatus(422);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user