Skip to content

Maltonoloco/item store#6

Merged
maltonoloco merged 47 commits intoOpenTaberna:mainfrom
maltonoloco:maltonoloco/item_store
Mar 4, 2026
Merged

Maltonoloco/item store#6
maltonoloco merged 47 commits intoOpenTaberna:mainfrom
maltonoloco:maltonoloco/item_store

Conversation

@maltonoloco
Copy link
Contributor

@maltonoloco maltonoloco commented Mar 2, 2026

Feature

Description

Complete CRUD service for managing store items, following the mini-API architecture pattern. Includes 6 REST endpoints covering the full item lifecycle with support for pagination, slug-based lookup, and flexible data storage.

The data model uses PostgreSQL JSONB for nested structures (pricing, inventory, shipping, media), allowing custom fields without schema migrations while maintaining indexed columns for fast queries on core fields.

Motivation

Reference implementation of the mini-API pattern with sufficient complexity to showcase repository layer, validation, and error handling. Provides foundation for e-commerce item management with extensibility for future plugins.

API Changes

  • New endpoints added
  • Existing endpoints modified
  • Breaking changes

New Endpoints:

  • POST /api/v1/items/ - Create item
  • GET /api/v1/items/{uuid} - Get by UUID
  • GET /api/v1/items/ - List with pagination and filtering
  • GET /api/v1/items/by-slug/{slug} - Get by URL slug
  • PATCH /api/v1/items/{uuid} - Partial update
  • DELETE /api/v1/items/{uuid} - Delete item

Database Changes

  • New tables/columns added
  • Migrations required
  • No database changes

New items table with indexed core fields (sku, slug, name, brand, status) and JSONB columns for nested data (price, inventory, shipping, attributes, identifiers). Tables auto-create on startup in development mode.

Documentation

  • API documentation updated (docs/)
  • README updated if necessary
  • Code comments added

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • All tests passing

Related Issues

Closes #

Checklist

  • Code follows project style guidelines
  • Environment variables documented in env.example if needed

Implement full e-commerce item management service following
OpenTaberna mini-API architecture pattern.

- 6 RESTful CRUD endpoints with proper HTTP semantics
- Repository pattern with specialized queries
- UUID primary keys with automatic timestamps
- PostgreSQL JSONB for flexible nested data
- Comprehensive validation and error handling

- \`POST /api/v1/items/\` - Create item (201)
- \`GET /api/v1/items/{uuid}\` - Get by UUID (200/404)
- \`GET /api/v1/items/\` - List with pagination (200)
- \`GET /api/v1/items/by-slug/{slug}\` - Get by slug (200/404)
- \`PATCH /api/v1/items/{uuid}\` - Update item (200/404/400)
- \`DELETE /api/v1/items/{uuid}\` - Delete item (204/404)

- 9 enums (ItemStatus, StockStatus, TaxClass, etc.)
- 8 nested models (PriceModel, MediaModel, InventoryModel, etc.)
- Pydantic v2 with ConfigDict for validation
- SQLAlchemy async ORM with indexed columns

- Duplicate SKU/slug validation with 400 responses
- Pagination with configurable skip/limit
- Status-based filtering
- JSONB storage for attributes, identifiers, custom data
- Async/await for non-blocking I/O
- Proper dependency injection with get_session_dependency

BREAKING CHANGE: Renames service directory from crud-item-store
to crud_item_store (Python naming convention)
Copy link
Contributor

@PhilippTheServer PhilippTheServer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR. I left some review comments you might want to look at.

src/app/main.py Outdated
from app.shared.database.engine import close_database, get_engine, init_database


@asynccontextmanager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This belongs in its own routers file in the chore dir and not in main.py

Copy link
Contributor

@PhilippTheServer PhilippTheServer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the restructuring. When you mode the buisness logic out of the routers file feel free to merge the PR. Thanks for your contribution

Copy link
Contributor

@PhilippTheServer PhilippTheServer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@maltonoloco maltonoloco merged commit 5f086b5 into OpenTaberna:main Mar 4, 2026
1 check failed
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.

2 participants