refactor(catalog): nest catalog routes under tenant

Move Catalog endpoints under /api/tenants/{tenant:codigo} and derive tenant
context from the route instead of request payload fields.

- scope marcas, categorias, productos, and product-attributes by tenant
- enforce tenant ownership in catalog controllers
- remove tenant_codigo and tenant_code from Catalog request validation
- update product attribute tests to use tenant-scoped routes
This commit is contained in:
2026-06-24 15:16:38 -03:00
parent c6e5177df1
commit 1907178e52
13 changed files with 123 additions and 50 deletions

View File

@@ -18,8 +18,7 @@ class ProductAttributeControllerTest extends TestCase
'dominio' => 'acme.com',
]);
$response = $this->postJson('/api/product-attributes', [
'tenant_codigo' => 'acme',
$response = $this->postJson('/api/tenants/acme/product-attributes', [
'codigo' => 'color',
'nombre' => 'Color',
'is_required' => true,
@@ -69,8 +68,7 @@ class ProductAttributeControllerTest extends TestCase
'dominio' => 'acme.com',
]);
$response = $this->postJson('/api/product-attributes', [
'tenant_codigo' => 'acme',
$response = $this->postJson('/api/tenants/acme/product-attributes', [
'codigo' => 'material',
'nombre' => 'Material',
'type' => 'text',