
Features include: - User management with JWT authentication and role-based access - Inventory items with SKU/barcode tracking and stock management - Categories and suppliers organization - Inventory transactions with automatic stock updates - Low stock alerts and advanced search/filtering - RESTful API with comprehensive CRUD operations - SQLite database with Alembic migrations - Auto-generated API documentation Co-Authored-By: Claude <noreply@anthropic.com>
11 lines
458 B
Python
11 lines
458 B
Python
from typing import Optional
|
|
from sqlalchemy.orm import Session
|
|
from app.crud.base import CRUDBase
|
|
from app.models.category import Category
|
|
from app.schemas.category import CategoryCreate, CategoryUpdate
|
|
|
|
class CRUDCategory(CRUDBase[Category, CategoryCreate, CategoryUpdate]):
|
|
def get_by_name(self, db: Session, *, name: str) -> Optional[Category]:
|
|
return db.query(Category).filter(Category.name == name).first()
|
|
|
|
category = CRUDCategory(Category) |