Fix single checkin GET to include username via JOIN
This commit is contained in:
@@ -1584,7 +1584,7 @@ def list_checkins(
|
|||||||
@app.get("/api/checkins/{checkin_id}")
|
@app.get("/api/checkins/{checkin_id}")
|
||||||
def get_checkin(checkin_id: int):
|
def get_checkin(checkin_id: int):
|
||||||
conn = get_db()
|
conn = get_db()
|
||||||
row = conn.execute("SELECT * FROM checkins WHERE id = ?", (checkin_id,)).fetchone()
|
row = conn.execute("SELECT c.*, u.username FROM checkins c LEFT JOIN users u ON c.user_id = u.id WHERE c.id = ?", (checkin_id,)).fetchone()
|
||||||
if row is None:
|
if row is None:
|
||||||
conn.close()
|
conn.close()
|
||||||
raise HTTPException(status_code=404, detail="Checkin not found")
|
raise HTTPException(status_code=404, detail="Checkin not found")
|
||||||
|
|||||||
Reference in New Issue
Block a user