feat: add endpoint to retrieve selected bank account for a tenant and update routes with authentication

This commit is contained in:
2026-07-03 13:54:31 -03:00
parent b1e40b3430
commit c1b7b12fe1
5 changed files with 60 additions and 5 deletions

View File

@@ -64,4 +64,13 @@ class BankAccountController extends Controller
return TenantResource::make($tenant->loadMissing(['headerLogo', 'footerLogo', 'selectedBankAccount']));
}
public function selected(Tenant $tenant): JsonResponse
{
$account = $tenant->selectedBankAccount;
abort_if(!$account, 404, 'No bank account is currently selected for this tenant.');
return BankAccountResource::make($account)->response();
}
}

View File

@@ -15,7 +15,7 @@ class BootstrapTenantController extends Controller
$dominio = $request->validated('dominio');
return TenantResource::make(
Tenant::query()->with(['headerLogo', 'footerLogo', 'selectedBankAccount'])->where('dominio', $dominio)->firstOrFail()
Tenant::query()->with(['headerLogo', 'footerLogo'])->where('dominio', $dominio)->firstOrFail()
);
}
}