8000 Update Active Game Session State As Game Progresses · Issue #463 · Lead-Studios/DeWordle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Update Active Game Session State As Game Progresses #463

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Ibinola opened this issue May 31, 2025 · 0 comments
Open

Update Active Game Session State As Game Progresses #463

Ibinola opened this issue May 31, 2025 · 0 comments

Comments

@Ibinola
Copy link
Contributor
Ibinola commented May 31, 2025

Description

This endpoint updates the current session with incremental progress — such as newly found words, spangram completion, hints used, or completion state. It is used by the frontend to sync session state when progress is made.

Authentication

Required – JWT Token

Request Body Example

{
  "foundWords": ["sun", "beam"],
  "nonThemeWords": ["fun"],
  "earnedHints": 1,
  "activeHint": "sunrise",
  "isCompleted": false
}

Backend Logic

  1. Extract userId from JWT.
  2. Fetch today’s session for the user.
  3. Update provided fields (foundWords, nonThemeWords, earnedHints, activeHint, isCompleted) only if they exist in the request body.
  4. Return the updated session.

Response Example

{
  "session": {
    "userId": "123",
    "foundWords": [...],
    "earnedHints": 2,
    "isCompleted": true
  }
}

Tasks

  • Add route: PATCH /sessions/update
  • Handle partial updates in service layer
  • Sanitise Inputs
  • Write unit tests (Valid updates persist, Invalid fields are ignored, Auth and session checks)

Acceptance Criteria

  • Session is partially updated correctly.
  • Only the provided fields are changed.
  • Proper error messages for missing/unauthorized sessions.
  • Does not create a new session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant
0