Skip to content

Commit d563e1a

Browse files
committed
refactor: remove src/archive directory and cardUtils; prepare for poker-engine integration; remove custom card dealing logic
1 parent c41d3bf commit d563e1a

3 files changed

Lines changed: 9 additions & 102 deletions

File tree

src/actions/games/poker/room/services/cardUtils.ts

Lines changed: 0 additions & 73 deletions
This file was deleted.

src/actions/games/poker/room/services/gameFlow.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { HandlerContext } from '@/modules/core/handler';
22
import { logFunctionStart, logFunctionEnd } from '@/modules/core/logger';
33
import { createHand } from './handRepo';
4-
import { bulkCreateSeats, postBlind, dealHoleCards } from './seatsRepo';
4+
import { bulkCreateSeats, postBlind } from './seatsRepo';
55
import { createAction } from './actionsRepo';
66
import { createMainPot } from './potsRepo';
77
import { getRoom } from './roomRepo';
8-
import { createDeck, dealCards, cardsToString } from './cardUtils';
8+
// TODO: Import poker-engine properly
9+
// import { startHand, type EngineConfig, type Seat } from '@gamehub/poker-engine';
910

1011
export async function startHandForRoom(context: HandlerContext, roomId: string): Promise<void> {
1112
logFunctionStart('gameFlow.startHandForRoom', { roomId, userId: context.user.id });
@@ -45,16 +46,8 @@ export async function startHandForRoom(context: HandlerContext, roomId: string):
4546
// Create main pot with all active seats
4647
await createMainPot(hand.id, players.map((_, idx) => idx));
4748

48-
// Deal hole cards to each player
49-
const deck = createDeck(hand.deck_seed);
50-
let remainingDeck = deck;
51-
52-
for (let i = 0; i < players.length; i++) {
53-
const { cards, remainingDeck: newDeck } = dealCards(remainingDeck, 2);
54-
remainingDeck = newDeck;
55-
const cardStrings = cards.map(card => cardsToString([card]));
56-
await dealHoleCards(hand.id, i, cardStrings);
57-
}
49+
// TODO: Use poker-engine to deal cards
50+
// For now, skip card dealing until poker-engine is properly integrated
5851

5952
// Post blinds and record actions
6053
await postBlind(hand.id, sbPos, sb);

src/actions/games/poker/room/services/seatsRepo.ts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,9 @@ export async function listSeatsByHand(handId: string): Promise<SeatRecord[]> {
9898
}
9999
}
100100

101-
export async function dealHoleCards(handId: string, seatPos: number, cards: string[]): Promise<void> {
102-
logFunctionStart('seatsRepo.dealHoleCards', { handId, seatPos, cards });
103-
try {
104-
const { supabaseFor } = await import('@/lib/supabase');
105-
const poker = supabaseFor('poker');
106-
const { error } = await poker
107-
.from('seats')
108-
.update({ hole: cards })
109-
.eq('hand_id', handId)
110-
.eq('seat_pos', seatPos);
111-
if (error) throw error;
112-
logFunctionEnd('seatsRepo.dealHoleCards', { ok: true });
113-
} catch (err) {
114-
logError('seatsRepo.dealHoleCards', err as Error, { handId, seatPos, cards });
115-
throw err;
116-
}
117-
}
101+
// TODO: Use poker-engine for card dealing
102+
// export async function dealHoleCards(handId: string, seatPos: number, cards: string[]): Promise<void> {
103+
// // Implementation will be moved to poker-engine
104+
// }
118105

119106

0 commit comments

Comments
 (0)