16 lines
407 B
Python
16 lines
407 B
Python
from typing import Optional
|
|
|
|
from sqlalchemy.orm import Session
|
|
|
|
from app.crud.base import CRUDBase
|
|
from app.models.item import Item
|
|
from app.schemas.item import ItemCreate, ItemUpdate
|
|
|
|
|
|
class CRUDItem(CRUDBase[Item, ItemCreate, ItemUpdate]):
|
|
def get_by_title(self, db: Session, *, title: str) -> Optional[Item]:
|
|
return db.query(Item).filter(Item.title == title).first()
|
|
|
|
|
|
item = CRUDItem(Item)
|