feat(bootstrap): expose website type favicon
This commit is contained in:
parent
ff61a3d3b8
commit
bbe3cf82f5
|
|
@ -30,6 +30,7 @@ class AdminAppBootstrapResource extends JsonResource
|
|||
'login_header_footer_color' => $websiteType->login_header_footer_color,
|
||||
'site_logo' => $websiteType->siteLogo?->getTemporaryUrl(1440),
|
||||
'footer_logo' => $websiteType->footerLogo?->getTemporaryUrl(1440),
|
||||
'favicon' => $websiteType->favicon?->getTemporaryUrl(1440),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class AdminAppBootstrapService
|
|||
{
|
||||
return [
|
||||
'website_type' => WebsiteType::query()
|
||||
->with(['siteLogo', 'footerLogo'])
|
||||
->with(['siteLogo', 'footerLogo', 'favicon'])
|
||||
->where('dominio', $domain)
|
||||
->firstOrFail(),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ class ScannerBootstrapService
|
|||
{
|
||||
return [
|
||||
'website_type' => WebsiteType::query()
|
||||
->with(['siteLogo', 'footerLogo'])
|
||||
->with(['siteLogo', 'footerLogo', 'favicon'])
|
||||
->where('scanner_domain', $domain)
|
||||
->firstOrFail(),
|
||||
];
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class BootstrapAdminAppControllerTest extends TestCase
|
|||
public function test_it_publicly_bootstraps_the_admin_app_by_domain(): void
|
||||
{
|
||||
$footerLogo = Attachment::factory()->create();
|
||||
$favicon = Attachment::factory()->create();
|
||||
|
||||
WebsiteType::query()->create([
|
||||
'codigo' => 'shopit',
|
||||
|
|
@ -31,6 +32,7 @@ class BootstrapAdminAppControllerTest extends TestCase
|
|||
'border_color' => '#eaeaea',
|
||||
'login_header_footer_color' => '#313131',
|
||||
'footer_logo' => $footerLogo->id,
|
||||
'favicon_id' => $favicon->id,
|
||||
]);
|
||||
|
||||
$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.site_logo', null)
|
||||
->assertJsonPath('data.footer_logo', $footerLogo->getTemporaryUrl(1440))
|
||||
->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440))
|
||||
->assertJsonMissingPath('data.forms')
|
||||
->assertJsonMissingPath('data.codigo')
|
||||
->assertJsonMissingPath('data.nombre')
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ class BootstrapScannerControllerTest extends TestCase
|
|||
public function test_it_publicly_bootstraps_the_scanner_by_scanner_domain(): void
|
||||
{
|
||||
$siteLogo = Attachment::factory()->create();
|
||||
$favicon = Attachment::factory()->create();
|
||||
|
||||
WebsiteType::query()->create([
|
||||
'codigo' => 'shopit',
|
||||
|
|
@ -32,6 +33,7 @@ class BootstrapScannerControllerTest extends TestCase
|
|||
'border_color' => '#eaeaea',
|
||||
'login_header_footer_color' => '#313131',
|
||||
'site_logo' => $siteLogo->id,
|
||||
'favicon_id' => $favicon->id,
|
||||
]);
|
||||
|
||||
$this->getJson('/api/v1/scanner/bootstrap/SCANNER.SHOPIT.TEST')
|
||||
|
|
@ -40,6 +42,7 @@ class BootstrapScannerControllerTest extends TestCase
|
|||
->assertJsonPath('data.primary_color', '#112233')
|
||||
->assertJsonPath('data.site_logo', $siteLogo->getTemporaryUrl(1440))
|
||||
->assertJsonPath('data.footer_logo', null)
|
||||
->assertJsonPath('data.favicon', $favicon->getTemporaryUrl(1440))
|
||||
->assertJsonMissingPath('data.codigo')
|
||||
->assertJsonMissingPath('data.nombre')
|
||||
->assertJsonMissingPath('data.dominio')
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ class AdminAppBootstrapResourceTest extends TestCase
|
|||
]);
|
||||
$websiteType->setRelation('siteLogo', null);
|
||||
$websiteType->setRelation('footerLogo', null);
|
||||
$websiteType->setRelation('favicon', null);
|
||||
$data = AdminAppBootstrapResource::make([
|
||||
'website_type' => $websiteType,
|
||||
])->resolve(request());
|
||||
|
||||
$this->assertSame('shopit', $data['website_type_code']);
|
||||
$this->assertNull($data['favicon']);
|
||||
$this->assertArrayNotHasKey('forms', $data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue