-
-
Save morintd/2bafcff1026a6dac5dc4e11e3ff7880b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { GameDomainModel } from "../game.domain-model"; | |
import { Board } from "../entities/board.entity"; | |
import { IBoardRepository } from "../ports/board-repository.port"; | |
export class InMemoryBoardRepository implements IBoardRepository { | |
private history: GameDomainModel.Squares[] = []; | |
findHistory() { | |
return Promise.resolve( | |
this.history.map((squares) => new Board({ squares })) | |
); | |
} | |
async setHistory(boards: Board[]) { | |
this.history = boards.map((board) => board.squares); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment