Skip to content

Instantly share code, notes, and snippets.

@morintd
Last active March 10, 2024 18:10
Show Gist options
  • Save morintd/2bafcff1026a6dac5dc4e11e3ff7880b to your computer and use it in GitHub Desktop.
Save morintd/2bafcff1026a6dac5dc4e11e3ff7880b to your computer and use it in GitHub Desktop.
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