84 lines
No EOL
6 KiB
Python
84 lines
No EOL
6 KiB
Python
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
|
|
|
|
#Fruit shop
|
|
melon = product_classes.Product(name="Meloen", price=2.0, barcode=1000 ,image_filename="fruit/melon")
|
|
pear = product_classes.Product(name="Peer", price=1.0, barcode=1001 ,image_filename="fruit/pear")
|
|
peach = product_classes.Product(name="Perzik", price=1.0, barcode=1002 ,image_filename="fruit/peach")
|
|
orange = product_classes.Product(name="Appelsien", price=1.0, barcode=1003 ,image_filename="fruit/orange")
|
|
apple = product_classes.Product(name="Appel", price=1.0, barcode=1004 ,image_filename="fruit/apple")
|
|
banana = product_classes.Product(name="Banana", price=1.0, barcode=1005 ,image_filename="fruit/banana")
|
|
cherry = product_classes.Product(name="Kers", price=1.0, barcode=1006 ,image_filename="fruit/cherry")
|
|
kiwi = product_classes.Product(name="Kiwi", price=1.0, barcode=1007 ,image_filename="fruit/kiwi")
|
|
grape = product_classes.Product(name="Druif", price=2.0, barcode=1008 ,image_filename="fruit/grape")
|
|
strawberry = product_classes.Product(name="Aardbei", price=1.0, barcode=1009 ,image_filename="fruit/strawberry")
|
|
pineapple = product_classes.Product(name="Ananas", price=2.0, barcode=1010 ,image_filename="fruit/pineapple")
|
|
blueberry = product_classes.Product(name="Bosbes", price=1.0, barcode=1011 ,image_filename="fruit/blueberry")
|
|
raspberry = product_classes.Product(name="Framboos", price=1.0, barcode=1012 ,image_filename="fruit/raspberry")
|
|
lemon = product_classes.Product(name="Citroen", price=1.0, barcode=1013 ,image_filename="fruit/lemon")
|
|
|
|
#Garage shop
|
|
tire = product_classes.Product(name="Wiel", price=5.0, barcode=1014 ,image_filename="garage/tire")
|
|
wash = product_classes.Product(name="Wassen", price=3.0, barcode=1015 ,image_filename="garage/wash")
|
|
oil = product_classes.Product(name="Olie", price=2.0, barcode=1016 ,image_filename="garage/oil")
|
|
gas = product_classes.Product(name="Benzine", price=5.0, barcode=1017 ,image_filename="garage/gas")
|
|
work_time = product_classes.Product(name="Werkuren", price=2.0, barcode=1018 ,image_filename="garage/work_time")
|
|
tool_usage = product_classes.Product(name="Gereedschap gebruik", price=1.0, barcode=1019 ,image_filename="garage/tool_usage")
|
|
steering_wheel = product_classes.Product(name="Stuurwiel", price=3.0, barcode=1020 ,image_filename="garage/steering_wheel")
|
|
air_pump = product_classes.Product(name="Luchtpomp", price=1.0, barcode=1021 ,image_filename="garage/air_pump")
|
|
bike_bell = product_classes.Product(name="Fietsbel", price=1.0, barcode=1022 ,image_filename="garage/bike_bell")
|
|
light = product_classes.Product(name="Licht", price=2.0, barcode=1023 ,image_filename="garage/light")
|
|
flashlight = product_classes.Product(name="Zaklamp", price=1.0, barcode=1024 ,image_filename="garage/flashlight")
|
|
search = product_classes.Product(name="Zoeken", price=2.0, barcode=1025 ,image_filename="garage/search")
|
|
|
|
#Animal stuff
|
|
birdfood = product_classes.Product(name="birdfood", price=5.0, barcode=1026 ,image_filename="animal_stuff/birdfood")
|
|
carrot = product_classes.Product(name="carrot", price=1.0, barcode=1027 ,image_filename="animal_stuff/carrot")
|
|
cat_food = product_classes.Product(name="cat_food", price=1.0, barcode=1028 ,image_filename="animal_stuff/cat_food")
|
|
dog_bath_product = product_classes.Product(name="dog_bath_product", price=2.0, barcode=1029 ,image_filename="animal_stuff/dog_bath_product")
|
|
dog_dish = product_classes.Product(name="dog_dish", price=10.0, barcode=1030 ,image_filename="animal_stuff/dog_dish")
|
|
dog_food = product_classes.Product(name="dog_food", price=5.0, barcode=1031 ,image_filename="animal_stuff/dog_food")
|
|
dog_leash = product_classes.Product(name="dog_leash", price=10.0, barcode=1032 ,image_filename="animal_stuff/dog_leash")
|
|
dog_toy = product_classes.Product(name="dog_toy", price=5.0, barcode=1033 ,image_filename="animal_stuff/dog_toy")
|
|
feather_toy = product_classes.Product(name="feather_toy", price=5.0, barcode=1034 ,image_filename="animal_stuff/feather_toy")
|
|
fish_food = product_classes.Product(name="fish_food", price=2.0, barcode=1035 ,image_filename="animal_stuff/fish_food")
|
|
hair_brush = product_classes.Product(name="hair_brush", price=2.0, barcode=1036 ,image_filename="animal_stuff/hair_brush")
|
|
hamster_food = product_classes.Product(name="hamster_food", price=5.0, barcode=1037 ,image_filename="animal_stuff/hamster_food")
|
|
|
|
#Animals
|
|
bird = product_classes.Product(name="bird", price=5.0, barcode=1038 ,image_filename="animals/bird")
|
|
bunny = product_classes.Product(name="bunny", price=5.0, barcode=1039 ,image_filename="animals/bunny")
|
|
cat = product_classes.Product(name="cat", price=10.0, barcode=1040 ,image_filename="animals/cat")
|
|
fish = product_classes.Product(name="fish", price=1.0, barcode=1041 ,image_filename="animals/fish")
|
|
hamster = product_classes.Product(name="hamster", price=5.0, barcode=1042 ,image_filename="animals/hamster")
|
|
husky = product_classes.Product(name="husky", price=10.0, barcode=1043 ,image_filename="animals/husky")
|
|
snake = product_classes.Product(name="snake", price=10.0, barcode=1044 ,image_filename="animals/snake")
|
|
turtle = product_classes.Product(name="turtle", price=5.0, barcode=1045 ,image_filename="animals/turtle")
|
|
|
|
product_list = [melon,pear,peach,orange,apple,banana,cherry,kiwi,grape,strawberry,pineapple,blueberry,raspberry,lemon,tire,wash,oil,gas,work_time,tool_usage,steering_wheel,air_pump,bike_bell,light,flashlight,search]
|
|
|
|
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() |