aim.digifeeds.database.crud module
Digifeeds Crud operations
Operations that act on the digifeeds database
- aim.digifeeds.database.crud.add_item(db: Session, item: ItemCreate)[source]
Add an item to the database. All you need is a barcode.
- Parameters:
db (sqlalchemy.orm.Session) – Digifeeds database session
item (schemas.ItemCreate) – Item object with a barcode
- Returns:
Item object
- Return type:
- aim.digifeeds.database.crud.add_item_status(db: Session, item: Item, status: Status)[source]
Add a status to an item in the database
- Parameters:
db (sqlalchemy.orm.Session) – Digifeeds database session
item (models.Item) – Item object
status (models.Status) – Status
- Returns:
Item object
- Return type:
- aim.digifeeds.database.crud.get_item(db: Session, barcode: str)[source]
Get item from the database
- Parameters:
db (sqlalchemy.orm.Session) – Digifeeds database session
barcode (str) – Barcode of the item
- Returns:
Item object
- Return type:
- aim.digifeeds.database.crud.get_items(db: Session, limit: int, offset: int, filter: ItemFilters = None)[source]
Get Digifeed items from the database
- Parameters:
db (sqlalchemy.orm.Session) – Digifeeds database session
filter (schemas.ItemFilters | None) – filter to apply to the list of items.
- Returns:
Item object
- Return type:
- aim.digifeeds.database.crud.get_items_statement(filter: ItemFilters = None)[source]
- aim.digifeeds.database.crud.get_items_total(db: Session, filter: ItemFilters = None)[source]
- aim.digifeeds.database.crud.get_status(db: Session, name: str)[source]
Gets a given status from the database based on the name
- Parameters:
db (sqlalchemy.orm.Session) – Digifeeds database session
name (str) – Name of the status
- Returns:
Status object
- Return type: