-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
35 lines (24 loc) · 938 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from fastapi.encoders import jsonable_encoder
from src.lunchheros.db.dbFetcher import filter_data, get_encoded_data
from src.routes.users.userFunctions import getAllQueryListData, getAllUsers, getUserWithId
from fastapi import FastAPI
from supabase_client import supabase_client
app = FastAPI()
@app.get("/")
def read_root():
data = supabase_client.table("category").select("*").execute()
return {"Hello": "World", "data" : data}
@app.get("/users")
def load_all_users():
allUsers = getAllUsers()
return { "allUsers" : allUsers}
@app.get("/users/{userId}")
def load_current_user(userId):
currentUser = getUserWithId(userId)
return { "currentUser" : currentUser}
@app.get("/button_trigger/{userId}")
def load_current_user(userId: str):
userData = getUserWithId(userId)
queryList = getAllQueryListData()
test = filter_data(queryList)
return { "currentUser" : userData, "query": queryList}