feat(admin): star/tags marks, service product-type filter, campaign bulk actions, SMTP test

- Star (is_starred) and colored tags for services, customers, orders, invoices:
  Markable trait, tags/taggables tables, PATCH administrator/marks/{type}/{key},
  tag CRUD, list filters starred / tag_ids[]
- GET administrator/services accepts product_type (falls back to product type
  for legacy rows without services.type)
- Mail campaigns: bulk cancel / retry failed / delete; cancelled campaigns are
  skipped by SendMailCampaignRecipient
- POST administrator/settings/test-smtp sends a test email through the saved
  mail transport

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-15 21:53:41 +07:00
co-authored by Claude Opus 5.5
parent 46aa138eec
commit 40bf6b54f9
33 changed files with 780 additions and 11 deletions
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\Api\Admin\Service;
use App\Models\Customer;
use App\Models\Product;
use App\Models\Service;
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Spatie\Permission\Models\Role;
use Tests\TestCase;
class ServiceListProductTypeFilterTest extends TestCase
{
use RefreshDatabase;
public function test_filters_services_by_product_type_including_legacy_rows_without_type(): void
{
Role::firstOrCreate(['name' => 'Full Administrator', 'guard_name' => 'admin']);
$admin = User::factory()->create();
$admin->assignRole('Full Administrator');
$customer = Customer::factory()->create();
foreach (['email' => 'mail.vn', 'hardware' => 'box.vn'] as $type => $serverName) {
$this->actingAs($admin, 'admin')->postJson(
"/api/v1/administrator/customers/{$customer->uuid}/services",
['product_id' => Product::factory()->create(['product_type' => $type])->id, 'payment_method' => 'transfer', 'server_name' => $serverName, 'amount_paid' => 0],
)->assertCreated();
}
Service::where('server_name', 'box.vn')->update(['type' => null]);
$email = $this->actingAs($admin, 'admin')->getJson('/api/v1/administrator/services?product_type=email')->assertOk();
$this->assertSame(['mail.vn'], array_column($email->json('data.items'), 'server_name'));
$this->assertSame('email', $email->json('data.items.0.product.product_type'));
$hardware = $this->actingAs($admin, 'admin')->getJson('/api/v1/administrator/services?product_type=hardware')->assertOk();
$this->assertSame(['box.vn'], array_column($hardware->json('data.items'), 'server_name'));
}
}