(sessionId: string, challengeId: string, hintId: string)
| 385 | } |
| 386 | |
| 387 | async unlockHint(sessionId: string, challengeId: string, hintId: string): Promise<void> { |
| 388 | const allHints = await this.getHintsByChallenge(challengeId); |
| 389 | const hint = allHints.find(h => h.id === hintId); |
| 390 | |
| 391 | if (!hint) { |
| 392 | throw new Error("Hint not found for this challenge"); |
| 393 | } |
| 394 | |
| 395 | if (hint.challengeId !== challengeId) { |
| 396 | throw new Error("Hint does not belong to this challenge"); |
| 397 | } |
| 398 | |
| 399 | const key = `${sessionId}:${challengeId}`; |
| 400 | let unlocked = this.unlockedHints.get(key); |
| 401 | |
| 402 | if (!unlocked) { |
| 403 | unlocked = new Set(); |
| 404 | this.unlockedHints.set(key, unlocked); |
| 405 | } |
| 406 | |
| 407 | unlocked.add(hintId); |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | export const storage = new MemStorage(); |
nothing calls this directly
no test coverage detected