From cc5e383c88bfb9fd69a309230ad691f3b1ac5757 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Bournhonesque?= Date: Thu, 11 Jan 2024 11:52:32 +0100 Subject: [PATCH] chore: add typing information --- app/crud.py | 2 +- app/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/crud.py b/app/crud.py index ffaebd4b..ea686cdb 100644 --- a/app/crud.py +++ b/app/crud.py @@ -88,7 +88,7 @@ def get_product_by_id(db: Session, id: int): return db.query(Product).filter(Product.id == id).first() -def get_product_by_code(db: Session, code: str): +def get_product_by_code(db: Session, code: str) -> Product: return db.query(Product).filter(Product.code == code).first() diff --git a/app/utils.py b/app/utils.py index 8b4a0f11..09f4b70e 100644 --- a/app/utils.py +++ b/app/utils.py @@ -75,7 +75,7 @@ def normalize_product_fields(product: JSONType) -> JSONType: return product -def fetch_product_openfoodfacts_details(product: ProductBase): +def fetch_product_openfoodfacts_details(product: ProductBase) -> JSONType | None: product = {} try: response = openfoodfacts_product_search(code=product.code)