Skip to content

Commit

Permalink
Add id to PlayerInGame
Browse files Browse the repository at this point in the history
  • Loading branch information
connor-baer committed Aug 8, 2024
1 parent 6610d35 commit 97c641a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions db/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ const players = [
{ id: createId(), name: 'Elderflower' },
];

const playersInGame = players.slice(0, 3).map((player, index) => ({
id: createId(),
gameId: games[0]?.id as string,
playerId: player.id,
position: index,
}));
const playersInGame = players
.slice(0, 3)
.map((player, index) => ({
gameId: games[0]?.id as string,
playerId: player.id,
position: index,
}))
.map((playerInGame) => ({
...playerInGame,
id: `${playerInGame.gameId}-${playerInGame.playerId}`,
}));

const scores = [
{
Expand Down
1 change: 1 addition & 0 deletions src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const server = {

const game = { id: createHumanId() };
const playersInGame = players.map((player, index) => ({
id: `${game.id}-${player.id}`,
gameId: game.id,
playerId: player.id,
position: index,
Expand Down

0 comments on commit 97c641a

Please sign in to comment.