feat(mail-campaigns): sender info + resolve typed emails against customers

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-22 21:18:53 +07:00
co-authored by Claude Opus 5.5
parent 54c14c41d8
commit e1efc88fd2
10 changed files with 277 additions and 18 deletions
+15
View File
@@ -55,6 +55,21 @@ class LeadApiTest extends TestCase
$this->assertSame(0, Lead::count());
}
public function test_index_filters_by_source_and_recorded_date(): void
{
$admin = $this->admin(['lead.view']);
$match = Lead::create(['email' => 'a@example.com', 'source' => 'whmcs_contact']);
Lead::create(['email' => 'b@example.com', 'source' => 'manual']);
$old = Lead::create(['email' => 'c@example.com', 'source' => 'whmcs_contact']);
$old->forceFill(['created_at' => now()->subMonth()])->saveQuietly();
$this->actingAs($admin, 'admin')
->getJson(self::BASE . '?' . http_build_query(['source' => 'whmcs_contact', 'date_from' => now()->subDay()->toDateString(), 'date_to' => now()->toDateString()]))
->assertOk()
->assertJsonPath('data.total', 1)
->assertJsonPath('data.items.0.uuid', $match->uuid);
}
public function test_permissions_are_enforced(): void
{
$viewer = $this->admin(['lead.view']);