Backend enhancements: auth, channels, restaurants, daemon improvements
- Add admin auth dependency and role checks - Expand channel and restaurant API routes - Improve YouTube transcript fetching - Enhance daemon worker with better error handling and scheduling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,5 +36,22 @@ def login_google(body: GoogleLoginRequest):
|
||||
|
||||
@router.get("/me")
|
||||
def get_me(current_user: dict = Depends(get_current_user)):
|
||||
"""Return current authenticated user info."""
|
||||
return current_user
|
||||
"""Return current authenticated user info including admin status."""
|
||||
from core.db import conn
|
||||
user_id = current_user.get("sub") or current_user.get("id")
|
||||
with conn() as c:
|
||||
cur = c.cursor()
|
||||
cur.execute(
|
||||
"SELECT id, email, nickname, avatar_url, is_admin FROM tasteby_users WHERE id = :id",
|
||||
{"id": user_id},
|
||||
)
|
||||
row = cur.fetchone()
|
||||
if not row:
|
||||
raise HTTPException(404, "User not found")
|
||||
return {
|
||||
"id": row[0],
|
||||
"email": row[1],
|
||||
"nickname": row[2],
|
||||
"avatar_url": row[3],
|
||||
"is_admin": bool(row[4]),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user