mirror of
https://gitlab.aachen.ccc.de/inventory/in.git
synced 2025-06-08 21:15:09 +02:00
autoformat by black+isort
This commit is contained in:
parent
5643dbe030
commit
eba9b410c6
3 changed files with 23 additions and 11 deletions
13
crud.py
13
crud.py
|
@ -1,14 +1,19 @@
|
|||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy import DECIMAL, cast
|
||||
|
||||
import models, schemas
|
||||
from sqlalchemy import DECIMAL, cast
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
import models
|
||||
import schemas
|
||||
|
||||
|
||||
def get_items(db: Session) -> list[models.Item]:
|
||||
return db.query(models.Item).all()
|
||||
|
||||
|
||||
def put_item(db: Session, id: str, item: schemas.Item):
|
||||
updated = bool(db.query(models.Item).filter(models.Item.id == id).update(item.dict()))
|
||||
updated = bool(
|
||||
db.query(models.Item).filter(models.Item.id == id).update(item.dict())
|
||||
)
|
||||
if not updated:
|
||||
db.add(models.Item(**item.dict()))
|
||||
db.commit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue