16 lines
416 B
Python
16 lines
416 B
Python
from typing import List
|
|
|
|
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) -> List[Item]:
|
|
return db.query(self.model).filter(self.model.title.contains(title)).all()
|
|
|
|
|
|
item = CRUDItem(Item)
|