sharktide commited on
Commit
289a1d6
·
verified ·
1 Parent(s): 563cc6a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -5
app.py CHANGED
@@ -30,7 +30,6 @@ class Recipe(BaseModel):
30
  name: str
31
  time: str
32
  creator: str
33
- user_id: Optional[str] = None
34
  category: str
35
  diff: str
36
  description: str
@@ -72,9 +71,6 @@ def add_recipe_to_supabase(recipe: Recipe, token_data=Depends(verify_token)):
72
  existing = supabase.table("recipes").select("name").eq("name", recipe.name).execute()
73
  user_id = token_data['sub']
74
 
75
- if recipe.user_id and recipe.user_id != user_id:
76
- raise HTTPException(status_code=403, detail="User ID in payload does not match authenticated user")
77
-
78
  if existing.data:
79
  raise HTTPException(status_code=400, detail="Recipe with this name already exists.")
80
 
@@ -83,7 +79,7 @@ def add_recipe_to_supabase(recipe: Recipe, token_data=Depends(verify_token)):
83
  "name": recipe.name,
84
  "time": recipe.time,
85
  "creator": recipe.creator,
86
- "user_id": recipe.user_id,
87
  "category": recipe.category,
88
  "diff": recipe.diff,
89
  "description": recipe.description,
 
30
  name: str
31
  time: str
32
  creator: str
 
33
  category: str
34
  diff: str
35
  description: str
 
71
  existing = supabase.table("recipes").select("name").eq("name", recipe.name).execute()
72
  user_id = token_data['sub']
73
 
 
 
 
74
  if existing.data:
75
  raise HTTPException(status_code=400, detail="Recipe with this name already exists.")
76
 
 
79
  "name": recipe.name,
80
  "time": recipe.time,
81
  "creator": recipe.creator,
82
+ "user_id": user_id,
83
  "category": recipe.category,
84
  "diff": recipe.diff,
85
  "description": recipe.description,