from src.classes import product_classes, user_classes from src.modules import db_connection from sqlmodel import Session from typing import Annotated from src.modules import auth_manager from fastapi import Depends melon = product_classes.Product(name="Meloen", price=2.0, barcode=1000 ,image_filename="melon") pear = product_classes.Product(name="Peer", price=1.0, barcode=1001 ,image_filename="pear") peach = product_classes.Product(name="Perzik", price=1.0, barcode=1002 ,image_filename="peach") orange = product_classes.Product(name="Appelsien", price=1.0, barcode=1003 ,image_filename="orange") apple = product_classes.Product(name="Appel", price=1.0, barcode=1004 ,image_filename="apple") banana = product_classes.Product(name="Banana", price=1.0, barcode=1005 ,image_filename="banana") cherry = product_classes.Product(name="Kers", price=1.0, barcode=1006 ,image_filename="cherry") kiwi = product_classes.Product(name="Kiwi", price=1.0, barcode=1007 ,image_filename="kiwi") grape = product_classes.Product(name="Druif", price=2.0, barcode=1008 ,image_filename="grape") strawberry = product_classes.Product(name="Aardbei", price=1.0, barcode=1009 ,image_filename="strawberry") pineapple = product_classes.Product(name="Ananas", price=2.0, barcode=1010 ,image_filename="pineapple") blueberry = product_classes.Product(name="Bosbes", price=1.0, barcode=1011 ,image_filename="blueberry") raspberry = product_classes.Product(name="Framboos", price=1.0, barcode=1012 ,image_filename="raspberry") lemon = product_classes.Product(name="Citroen", price=1.0, barcode=1013 ,image_filename="lemon") product_list = [melon,pear,peach,orange,apple,banana,cherry,kiwi,grape,strawberry,pineapple,blueberry,raspberry,lemon] def get_all_products() -> list[product_classes.Product]: return product_list def get_single_product(barcode: int) -> product_classes.Product: for product in product_list: if product.barcode == barcode: return product def get_user_by_username(session: Session, username: str) -> user_classes.UserInDB: return db_connection.get_user_by_username(session, username) def create_db_and_tables() -> None: db_connection.create_db_and_tables() def get_db_engine(): return db_connection.get_engine() def delete_database(): db_connection.delete_database()