2.7 KiB
2.7 KiB
Implementer — F-008 Catalog core: products domain
done -> work/artifacts/F-008/implementer.md
Summary
Implemented the catalog core product slice as a hexagonal backend module with product state, unique slugs, active-only public reads/search, SEO metadata, category assignment, migration, tests and composition-root wiring.
Changed files
project/src/modules/catalog/domain/product.tsproject/src/modules/catalog/domain/errors.tsproject/src/modules/catalog/domain/ports.tsproject/src/modules/catalog/application/product-use-cases.tsproject/src/modules/catalog/infrastructure/pg-product-repository.tsproject/src/modules/catalog/api/catalog.routes.tsproject/src/modules/catalog/index.tsproject/migrations/006_catalog_products.jsproject/src/app/build-app.tsproject/src/modules/catalog/tests/product-use-cases.test.tsproject/src/modules/catalog/tests/domain-purity.test.tsproject/src/app/tests/catalog.itest.tsbacklog/features.jsonwork/current.mdwork/artifacts/F-008/architect.md
Acceptance traceability
- Domain layer has zero database or HTTP imports
- Catalog domain files contain only type/model/port/error code.
- Covered by
src/modules/catalog/tests/domain-purity.test.tsand boundary lint.
- Duplicate slug returns HTTP 409
- Implemented through
catalog_products.slug UNIQUEandPRODUCT_SLUG_EXISTSmapping. - Covered by
src/app/tests/catalog.itest.ts.
- Implemented through
- Only active products appear in public listings
SearchProductsalways passesactiveOnly: true; repository filtersp.state = 'active'.- Covered by unit and integration tests.
- Public URL is
/productos/<slug>, never internal id- Implemented
GET /productos/:slugactive-only and serializedurl: /productos/<slug>. - Covered by integration test.
- Implemented
verify.shgreen- Verified after implementation.
Commands run
cd project && npm run typecheck— PASScd project && npm run lint— PASS after Prettier normalizationcd project && npm test— PASS: 59 passed, 28 skipped (DB integration skipped withoutTEST_DATABASE_URL)cd project && npm run build— PASScd project && npm run lint:boundaries— PASS: 71 files checked./scripts/verify.sh— PASS
Notes
- No new npm dependencies.
- Product mutation routes are admin-only via shared auth injected from the composition root.
- Public reads (
GET /productos/:slug,GET /products/search) are unauthenticated and active-only. - Category assignment validates category IDs against
categories_categorieswithout importing categories module internals. - Documentation stage should update README/API notes because new user-facing endpoints and product error codes were added.