def show_image(id, i_id): ret = DB.iurlById(int(id)) i_id = int(i_id) if i_id is None or i_id == 1: print("hello") return RedirectResponse(ret.url0) elif i_id == 2: return RedirectResponse(ret.url1) elif i_id == 3: return RedirectResponse(ret.url2)
def show_all_fishes(): r = DB.simpleItemSearch("category", 0) res = [] for item in r: res.append(item) return res
def show_one_onsaleproduct(id): r = DB.searchProductById(int(id)) if r and r[0]["sale"] == True: return r else: raise HTTPException(status_code=404, detail="Item not found")
def show_all_onsaleproducts(): r = DB.simpleItemSearch("sale", True) res = [] for item in r: res.append(item["name"]) return res
def show_all_availableproducts(): r = DB.simpleItemSearch("availability", True) res = [] for item in r: res.append(item["name"]) return res
def read_root(): DB.initDB() return {"Hello": "World"}
def show_all_coquillages(): r = DB.simpleItemSearch("category", 1) res = [] for item in r: res.append(item) return res
def updateDB(): r = requests.get(url=ADRESS_CANVA + "tig/products") DB.updateProductsTable(r.json())
def show_all_crustaces(): r = DB.simpleItemSearch("category", 2) res = [] for item in r: res.append(item) return res