(
payload: ParticipantUpdate,
response: Response,
participant=Cookie(default=None, alias=COOKIE_NAME),
)
| 243 | |
| 244 | @app.post("/api/me") |
| 245 | def update_me( |
| 246 | payload: ParticipantUpdate, |
| 247 | response: Response, |
| 248 | participant=Cookie(default=None, alias=COOKIE_NAME), |
| 249 | ) -> dict: |
| 250 | current = get_or_create_participant(response, participant) |
| 251 | nickname = payload.nickname.strip() or default_nickname(current["id"]) |
| 252 | with connect() as conn: |
| 253 | conn.execute( |
| 254 | "UPDATE participants SET nickname = ?, updated_at = ? WHERE id = ?", |
| 255 | (nickname, now_iso(), current["id"]), |
| 256 | ) |
| 257 | row = conn.execute( |
| 258 | "SELECT * FROM participants WHERE id = ?", (current["id"],) |
| 259 | ).fetchone() |
| 260 | return {"participant": row_to_dict(row)} |
| 261 | |
| 262 | |
| 263 | @app.get("/api/challenges") |
nothing calls this directly
no test coverage detected