
- Setup project structure with FastAPI application - Create database models with SQLAlchemy - Configure Alembic for database migrations - Implement CRUD operations for products, categories, suppliers - Add inventory transaction functionality - Implement user authentication with JWT - Add health check endpoint - Create comprehensive documentation
13 lines
460 B
Python
13 lines
460 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) |