
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.supplier import Supplier
|
|
from app.schemas.supplier import SupplierCreate, SupplierUpdate
|
|
|
|
class CRUDSupplier(CRUDBase[Supplier, SupplierCreate, SupplierUpdate]):
|
|
def get_by_name(self, db: Session, *, name: str) -> Optional[Supplier]:
|
|
return db.query(Supplier).filter(Supplier.name == name).first()
|
|
|
|
supplier = CRUDSupplier(Supplier) |