feat(bootstrap): expose website type favicon

This commit is contained in:
2026-08-26 14:37:25 -03:00
parent ff61a3d3b8
commit bbe3cf82f5
6 changed files with 11 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ class AdminAppBootstrapResource extends JsonResource
'login_header_footer_color' => $websiteType->login_header_footer_color, 'login_header_footer_color' => $websiteType->login_header_footer_color,
'site_logo' => $websiteType->siteLogo?->getTemporaryUrl(1440), 'site_logo' => $websiteType->siteLogo?->getTemporaryUrl(1440),
'footer_logo' => $websiteType->footerLogo?->getTemporaryUrl(1440), 'footer_logo' => $websiteType->footerLogo?->getTemporaryUrl(1440),
'favicon' => $websiteType->favicon?->getTemporaryUrl(1440),
]; ];
} }
} }

View File

@@ -11,7 +11,7 @@ class AdminAppBootstrapService
{ {
return [ return [
'website_type' => WebsiteType::query() 'website_type' => WebsiteType::query()
->with(['siteLogo', 'footerLogo']) ->with(['siteLogo', 'footerLogo', 'favicon'])
->where('dominio', $domain) ->where('dominio', $domain)
->firstOrFail(), ->firstOrFail(),
]; ];

View File

@@ -11,7 +11,7 @@ class ScannerBootstrapService
{ {
return [ return [
'website_type' => WebsiteType::query() 'website_type' => WebsiteType::query()
->with(['siteLogo', 'footerLogo']) ->with(['siteLogo', 'footerLogo', 'favicon'])
->where('scanner_domain', $domain) ->where('scanner_domain', $domain)
->firstOrFail(), ->firstOrFail(),
]; ];

View File

@@ -14,6 +14,7 @@ class BootstrapAdminAppControllerTest extends TestCase
public function test_it_publicly_bootstraps_the_admin_app_by_domain(): void public function test_it_publicly_bootstraps_the_admin_app_by_domain(): void
{ {
$footerLogo = Attachment::factory()->create(); $footerLogo = Attachment::factory()->create();
$favicon = Attachment::factory()->create();
WebsiteType::query()->create([ WebsiteType::query()->create([
'codigo' => 'shopit', 'codigo' => 'shopit',
@@ -31,6 +32,7 @@ class BootstrapAdminAppControllerTest extends TestCase
'border_color' => '#eaeaea', 'border_color' => '#eaeaea',
'login_header_footer_color' => '#313131', 'login_header_footer_color' => '#313131',
'footer_logo' => $footerLogo->id, 'footer_logo' => $footerLogo->id,
'favicon_id' => $favicon->id,
]); ]);
$this->getJson('/api/v1/adminapp/bootstrap/ADMIN.SHOPIT.TEST') $this->getJson('/api/v1/adminapp/bootstrap/ADMIN.SHOPIT.TEST')
@@ -41,6 +43,7 @@ class BootstrapAdminAppControllerTest extends TestCase
->assertJsonPath('data.login_header_footer_color', '#313131') ->assertJsonPath('data.login_header_footer_color', '#313131')
->assertJsonPath('data.site_logo', null) ->assertJsonPath('data.site_logo', null)
->assertJsonPath('data.footer_logo', $footerLogo->getTemporaryUrl(1440)) ->assertJsonPath('data.footer_logo', $footerLogo->getTemporaryUrl(1440))
->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440))
->assertJsonMissingPath('data.forms') ->assertJsonMissingPath('data.forms')
->assertJsonMissingPath('data.codigo') ->assertJsonMissingPath('data.codigo')
->assertJsonMissingPath('data.nombre') ->assertJsonMissingPath('data.nombre')

View File

@@ -14,6 +14,7 @@ class BootstrapScannerControllerTest extends TestCase
public function test_it_publicly_bootstraps_the_scanner_by_scanner_domain(): void public function test_it_publicly_bootstraps_the_scanner_by_scanner_domain(): void
{ {
$siteLogo = Attachment::factory()->create(); $siteLogo = Attachment::factory()->create();
$favicon = Attachment::factory()->create();
WebsiteType::query()->create([ WebsiteType::query()->create([
'codigo' => 'shopit', 'codigo' => 'shopit',
@@ -32,6 +33,7 @@ class BootstrapScannerControllerTest extends TestCase
'border_color' => '#eaeaea', 'border_color' => '#eaeaea',
'login_header_footer_color' => '#313131', 'login_header_footer_color' => '#313131',
'site_logo' => $siteLogo->id, 'site_logo' => $siteLogo->id,
'favicon_id' => $favicon->id,
]); ]);
$this->getJson('/api/v1/scanner/bootstrap/SCANNER.SHOPIT.TEST') $this->getJson('/api/v1/scanner/bootstrap/SCANNER.SHOPIT.TEST')
@@ -40,6 +42,7 @@ class BootstrapScannerControllerTest extends TestCase
->assertJsonPath('data.primary_color', '#112233') ->assertJsonPath('data.primary_color', '#112233')
->assertJsonPath('data.site_logo', $siteLogo->getTemporaryUrl(1440)) ->assertJsonPath('data.site_logo', $siteLogo->getTemporaryUrl(1440))
->assertJsonPath('data.footer_logo', null) ->assertJsonPath('data.footer_logo', null)
->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440))
->assertJsonMissingPath('data.codigo') ->assertJsonMissingPath('data.codigo')
->assertJsonMissingPath('data.nombre') ->assertJsonMissingPath('data.nombre')
->assertJsonMissingPath('data.dominio') ->assertJsonMissingPath('data.dominio')

View File

@@ -17,11 +17,13 @@ class AdminAppBootstrapResourceTest extends TestCase
]); ]);
$websiteType->setRelation('siteLogo', null); $websiteType->setRelation('siteLogo', null);
$websiteType->setRelation('footerLogo', null); $websiteType->setRelation('footerLogo', null);
$websiteType->setRelation('favicon', null);
$data = AdminAppBootstrapResource::make([ $data = AdminAppBootstrapResource::make([
'website_type' => $websiteType, 'website_type' => $websiteType,
])->resolve(request()); ])->resolve(request());
$this->assertSame('shopit', $data['website_type_code']); $this->assertSame('shopit', $data['website_type_code']);
$this->assertNull($data['favicon']);
$this->assertArrayNotHasKey('forms', $data); $this->assertArrayNotHasKey('forms', $data);
} }
} }