Skip to content

feat: Products module — SKU CRUD, search, Firestore repository#3

Open
cto-new[bot] wants to merge 1 commit into
mainfrom
feat/products-module
Open

feat: Products module — SKU CRUD, search, Firestore repository#3
cto-new[bot] wants to merge 1 commit into
mainfrom
feat/products-module

Conversation

@cto-new

@cto-new cto-new Bot commented Jun 8, 2026

Copy link
Copy Markdown

Summary

Implements the Products module — the core KPI for StockFlow (Active SKUs tracked).

Changes

New Files

  • product.controller.ts — 6 endpoints: GET /products, GET /products/:id, GET /products/:sku, POST /products, PATCH /products/:id, DELETE /products/:id
  • product.repository.ts — FirestoreProductRepository implementing IProductRepository with paginated queries, search, category filtering, sort, SKU uniqueness
  • create-product.dto.ts — Validation DTO with class-validator
  • update-product.dto.ts — Validation DTO with optional fields
  • query-product.dto.ts — Query DTO with pagination, search, filter, sort params
  • product.service.spec.ts — 11 unit tests

Modified Files

  • product.service.ts — Proper NotFoundException/ConflictException, SKU conflict check
  • inventory.module.ts — Registers ProductController and FirestoreProductRepository

Key Architecture Decisions

  • Firestore collection products, queries via composite indexes
  • nameLower field stored for case-insensitive prefix search
  • Soft delete via isActive flag
  • Pagination via Firestore offset+limit mapped to page/limit
  • Auth guards from AuthModule applied to all product endpoints

Testing

  • All 37 tests pass (16 auth + 11 products + 6 roles + 4 pagination)
  • TypeScript compiles cleanly

…ory, tests

- ProductController: 6 endpoints (list, get by id, get by sku, create, update, soft delete)
- ProductService: full IProductService implementation with validation
- FirestoreProductRepository: paginated queries, search by name, category filter, sort, SKU uniqueness
- DTOs: create-product, update-product, query-product (with class-validator)
- 11 unit tests for ProductService covering all operations
- InventoryModule updated with controller + repository registration
- All 37 tests passing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants