feat(website-type): add 'dominio' field to WebsiteType model and update related tests

This commit is contained in:
2026-07-31 12:06:27 -03:00
parent 893bea1492
commit 6858b387c3
4 changed files with 9 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
#[Fillable([ #[Fillable([
'codigo', 'codigo',
'nombre', 'nombre',
'dominio',
'primary_color', 'primary_color',
'secondary_color', 'secondary_color',
'danger_color', 'danger_color',

View File

@@ -9,7 +9,8 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::table('website_type', function (Blueprint $table): void { Schema::table('website_type', function (Blueprint $table): void {
$table->string('primary_color')->nullable()->after('nombre'); $table->string('dominio')->nullable()->unique()->after('nombre');
$table->string('primary_color')->nullable()->after('dominio');
$table->string('secondary_color')->nullable()->after('primary_color'); $table->string('secondary_color')->nullable()->after('primary_color');
$table->string('danger_color')->nullable()->after('secondary_color'); $table->string('danger_color')->nullable()->after('secondary_color');
$table->string('success_color')->nullable()->after('danger_color'); $table->string('success_color')->nullable()->after('danger_color');
@@ -31,6 +32,7 @@ return new class extends Migration
} }
$table->dropColumn([ $table->dropColumn([
'dominio',
'primary_color', 'primary_color',
'secondary_color', 'secondary_color',
'danger_color', 'danger_color',

View File

@@ -22,6 +22,7 @@ class WebsiteExtrasTest extends TestCase
'id', 'id',
'codigo', 'codigo',
'nombre', 'nombre',
'dominio',
'primary_color', 'primary_color',
'secondary_color', 'secondary_color',
'danger_color', 'danger_color',
@@ -67,6 +68,7 @@ class WebsiteExtrasTest extends TestCase
$type = WebsiteType::query()->create([ $type = WebsiteType::query()->create([
'codigo' => 'store', 'codigo' => 'store',
'nombre' => 'Tienda', 'nombre' => 'Tienda',
'dominio' => 'store.test',
'primary_color' => '#111111', 'primary_color' => '#111111',
'secondary_color' => '#222222', 'secondary_color' => '#222222',
'danger_color' => '#ff0000', 'danger_color' => '#ff0000',
@@ -93,6 +95,7 @@ class WebsiteExtrasTest extends TestCase
]); ]);
$this->assertTrue($type->extras()->firstOrFail()->is($typeExtra)); $this->assertTrue($type->extras()->firstOrFail()->is($typeExtra));
$this->assertSame('store.test', $type->dominio);
$this->assertSame('#111111', $type->primary_color); $this->assertSame('#111111', $type->primary_color);
$this->assertSame('#222222', $type->secondary_color); $this->assertSame('#222222', $type->secondary_color);
$this->assertSame('#ff0000', $type->danger_color); $this->assertSame('#ff0000', $type->danger_color);

View File

@@ -19,6 +19,7 @@ class WebsiteTypeServiceTest extends TestCase
$websiteType = app(WebsiteTypeService::class)->create([ $websiteType = app(WebsiteTypeService::class)->create([
'codigo' => 'marketplace', 'codigo' => 'marketplace',
'nombre' => 'Marketplace', 'nombre' => 'Marketplace',
'dominio' => 'marketplace.test',
'primary_color' => '#111111', 'primary_color' => '#111111',
'secondary_color' => '#222222', 'secondary_color' => '#222222',
'danger_color' => '#ff0000', 'danger_color' => '#ff0000',
@@ -35,6 +36,7 @@ class WebsiteTypeServiceTest extends TestCase
Storage::disk('s3')->assertExists($siteLogo->path); Storage::disk('s3')->assertExists($siteLogo->path);
$this->assertDatabaseHas('website_type', [ $this->assertDatabaseHas('website_type', [
'codigo' => 'marketplace', 'codigo' => 'marketplace',
'dominio' => 'marketplace.test',
'login_header_footer_color' => '#333333', 'login_header_footer_color' => '#333333',
'site_logo' => $siteLogo->id, 'site_logo' => $siteLogo->id,
]); ]);