diff --git a/apps/api/src/modules/auction/auction.gateway.ts b/apps/api/src/modules/auction/auction.gateway.ts index a7cd904e..c0c94a26 100644 --- a/apps/api/src/modules/auction/auction.gateway.ts +++ b/apps/api/src/modules/auction/auction.gateway.ts @@ -232,7 +232,8 @@ export class AuctionGateway const token = this.readHandshakeToken(socket); if (!token) { - throw new Error('Missing auction socket token.'); + // 임시 운영용: 경매 진행 중에는 로그인 없이도 관전/팀장 모드 선택/입찰을 허용한다. + return; } const { payload } = await this.jwtService.verify( diff --git a/apps/api/src/modules/auction/auction.service.ts b/apps/api/src/modules/auction/auction.service.ts index a9c3d199..44eb7f37 100644 --- a/apps/api/src/modules/auction/auction.service.ts +++ b/apps/api/src/modules/auction/auction.service.ts @@ -203,12 +203,7 @@ export class AuctionService { if (params.amount > team.points) { throw new BadRequestException('Bid exceeds team points.'); } - if ( - params.bidderUserId && - !team.captainUserId.equals(params.bidderUserId) - ) { - throw new BadRequestException('Bidder is not the captain of this team.'); - } + // 임시 운영용: 클라이언트에서 선택한 팀장 모드를 신뢰하고 실제 로그인 사용자 검증은 건너뛴다. auction.currentBid = params.amount; auction.currentBidder = params.side; @@ -218,7 +213,7 @@ export class AuctionService { auction.bids.push({ side: params.side, amount: params.amount, - bidderUserId: params.bidderUserId ?? team.captainUserId, + bidderUserId: team.captainUserId, timestamp: new Date(), }); await auction.save(); diff --git a/apps/web/src/api/mappers.ts b/apps/web/src/api/mappers.ts index dcd94b08..bf0931e1 100644 --- a/apps/web/src/api/mappers.ts +++ b/apps/web/src/api/mappers.ts @@ -12,8 +12,8 @@ import type { Position, RiotLane, TeamSide, -} from './types'; -import { POSITION_ORDER, sideLabel } from '../lib/league'; +} from "./types"; +import { POSITION_ORDER, sideLabel } from "../lib/league"; export interface ParticipantView { id: string; @@ -69,7 +69,7 @@ export interface AuctionPlayerView extends ParticipantView { overall: ApiRiotLaneStats; byLane: Partial>; primary: ApiRiotLaneStats | null; - primarySource: 'lane' | 'overall' | 'none'; + primarySource: "lane" | "overall" | "none"; }; } @@ -86,7 +86,7 @@ export interface AuctionTeamView { export interface AuctionStateView { matchId: string; - phase: ApiAuction['phase']; + phase: ApiAuction["phase"]; teams: [AuctionTeamView, AuctionTeamView]; currentPlayer: AuctionPlayerView | null; currentPlayerIndex: number; @@ -105,31 +105,31 @@ export interface AuctionStateView { } const MAP_LABELS: Record = { - 11: '소환사의 협곡', - 12: '칼바람 나락', - 21: '소환사의 협곡', - 22: '전략적 팀 전투', + 11: "소환사의 협곡", + 12: "칼바람 나락", + 21: "소환사의 협곡", + 22: "전략적 팀 전투", }; const TIER_NAMES: Record = { - IRON: '아이언', - BRONZE: '브론즈', - SILVER: '실버', - GOLD: '골드', - PLATINUM: '플래티넘', - EMERALD: '에메랄드', - DIAMOND: '다이아', - MASTER: '마스터', - GRANDMASTER: '그랜드마스터', - CHALLENGER: '챌린저', + IRON: "아이언", + BRONZE: "브론즈", + SILVER: "실버", + GOLD: "골드", + PLATINUM: "플래티넘", + EMERALD: "에메랄드", + DIAMOND: "다이아", + MASTER: "마스터", + GRANDMASTER: "그랜드마스터", + CHALLENGER: "챌린저", }; const POSITION_TO_RIOT_LANE: Record = { - TOP: 'TOP', - JGL: 'JUNGLE', - MID: 'MIDDLE', - ADC: 'BOTTOM', - SUP: 'UTILITY', + TOP: "TOP", + JGL: "JUNGLE", + MID: "MIDDLE", + ADC: "BOTTOM", + SUP: "UTILITY", }; function createEmptyLaneStats(): ApiRiotLaneStats { @@ -146,24 +146,28 @@ function createEmptyLaneStats(): ApiRiotLaneStats { }; } -function createEmptyRecentStatsView(): AuctionPlayerView['recentStats'] { +function createEmptyRecentStatsView(): AuctionPlayerView["recentStats"] { return { overall: createEmptyLaneStats(), byLane: {}, primary: null, - primarySource: 'none', + primarySource: "none", }; } function sortPreferredPositions(preferredPositions: ApiPositionPreference[]) { - return [...preferredPositions].sort((left, right) => left.priority - right.priority); + return [...preferredPositions].sort( + (left, right) => left.priority - right.priority, + ); } -function resolveMainAndSubPosition(preferredPositions: ApiPositionPreference[]) { +function resolveMainAndSubPosition( + preferredPositions: ApiPositionPreference[], +) { const sorted = sortPreferredPositions(preferredPositions); return { - mainPosition: sorted[0]?.position ?? 'MID', - subPosition: sorted[1]?.position ?? sorted[0]?.position ?? 'MID', + mainPosition: sorted[0]?.position ?? "MID", + subPosition: sorted[1]?.position ?? sorted[0]?.position ?? "MID", }; } @@ -177,8 +181,8 @@ function mapMatchParticipantToView( return { id: participant.userId, userId: participant.userId, - summonerName: participant.gameName ?? '알 수 없음', - tag: participant.tagLine ?? '----', + summonerName: participant.gameName ?? "알 수 없음", + tag: participant.tagLine ?? "----", tier: participant.tier, mainPosition, subPosition, @@ -204,7 +208,7 @@ function mapAuctionPlayerToView( mainPosition, subPosition, profileIconId: player.profileIconId, - masteries: player.masteries.slice(0, 3).map((mastery) => ({ + masteries: player.masteries.slice(0, 5).map((mastery) => ({ championId: mastery.championId, level: mastery.championLevel, points: mastery.championPoints, @@ -223,9 +227,9 @@ function createFallbackParticipant(userId: string): ParticipantView { id: userId, userId, summonerName: `User ${userId.slice(-4)}`, - tag: '----', - mainPosition: 'MID', - subPosition: 'MID', + tag: "----", + mainPosition: "MID", + subPosition: "MID", profileIconId: 0, }; } @@ -275,15 +279,15 @@ export function formatKoreanDate(dateLike: string | Date) { const date = new Date(dateLike); return { - date: new Intl.DateTimeFormat('ko-KR', { - year: 'numeric', - month: 'long', - day: 'numeric', - weekday: 'short', + date: new Intl.DateTimeFormat("ko-KR", { + year: "numeric", + month: "long", + day: "numeric", + weekday: "short", }).format(date), - time: new Intl.DateTimeFormat('ko-KR', { - hour: 'numeric', - minute: '2-digit', + time: new Intl.DateTimeFormat("ko-KR", { + hour: "numeric", + minute: "2-digit", }).format(date), }; } @@ -293,33 +297,33 @@ function pickPrimary( mainPosition: Position, ): { stats: ApiRiotLaneStats | null; - source: 'lane' | 'overall' | 'none'; + source: "lane" | "overall" | "none"; } { if (!summary) { - return { stats: null, source: 'none' }; + return { stats: null, source: "none" }; } const laneStats = summary.byLane[POSITION_TO_RIOT_LANE[mainPosition]]; if (laneStats && laneStats.games > 0) { - return { stats: laneStats, source: 'lane' }; + return { stats: laneStats, source: "lane" }; } if (summary.overall.games > 0) { - return { stats: summary.overall, source: 'overall' }; + return { stats: summary.overall, source: "overall" }; } - return { stats: null, source: 'none' }; + return { stats: null, source: "none" }; } export function selectPrimaryTier(tiers: ApiTierInfo[]) { - return tiers.find((tier) => tier.queueType === 'RANKED_SOLO_5x5') ?? tiers[0]; + return tiers.find((tier) => tier.queueType === "RANKED_SOLO_5x5") ?? tiers[0]; } export function formatTierLabel(tier?: ApiTierInfo) { - if (!tier) return '미등록'; + if (!tier) return "미등록"; const tierName = TIER_NAMES[tier.tier] ?? tier.tier; - const highTier = ['MASTER', 'GRANDMASTER', 'CHALLENGER'].includes(tier.tier); + const highTier = ["MASTER", "GRANDMASTER", "CHALLENGER"].includes(tier.tier); if (highTier && tier.leaguePoints > 0) { return `${tierName} ${tier.leaguePoints}LP`; @@ -330,28 +334,28 @@ export function formatTierLabel(tier?: ApiTierInfo) { export function getTierColorToken(tier?: ApiTierInfo) { switch (tier?.tier) { - case 'CHALLENGER': - return 'text-amber-400'; - case 'GRANDMASTER': - return 'text-red-400'; - case 'MASTER': - return 'text-fuchsia-400'; - case 'DIAMOND': - return 'text-cyan-400'; - case 'EMERALD': - return 'text-emerald-400'; - case 'PLATINUM': - return 'text-teal-300'; - case 'GOLD': - return 'text-yellow-400'; - case 'SILVER': - return 'text-gray-300'; - case 'BRONZE': - return 'text-amber-700'; - case 'IRON': - return 'text-stone-400'; + case "CHALLENGER": + return "text-amber-400"; + case "GRANDMASTER": + return "text-red-400"; + case "MASTER": + return "text-fuchsia-400"; + case "DIAMOND": + return "text-cyan-400"; + case "EMERALD": + return "text-emerald-400"; + case "PLATINUM": + return "text-teal-300"; + case "GOLD": + return "text-yellow-400"; + case "SILVER": + return "text-gray-300"; + case "BRONZE": + return "text-amber-700"; + case "IRON": + return "text-stone-400"; default: - return 'text-base-content/50'; + return "text-base-content/50"; } } @@ -374,7 +378,8 @@ export function mapApiMatchToMatchDetail(match: ApiMatch): MatchDetailView { name: team.name || sideLabel(team.side), participants: team.members.map((member) => { const participant = - participantLookup.get(member.userId) ?? createFallbackParticipant(member.userId); + participantLookup.get(member.userId) ?? + createFallbackParticipant(member.userId); return { ...participant, @@ -428,33 +433,37 @@ export function mapApiAuctionToAuctionState( auctionOrder.map((player) => [player.userId, player]), ); const blueTeam = - auction.teams.find((team) => team.side === 'blue') ?? + auction.teams.find((team) => team.side === "blue") ?? ({ - side: 'blue', - captainUserId: '', + side: "blue", + captainUserId: "", points: 0, members: [], } satisfies ApiAuctionTeam); const redTeam = - auction.teams.find((team) => team.side === 'red') ?? + auction.teams.find((team) => team.side === "red") ?? ({ - side: 'red', - captainUserId: '', + side: "red", + captainUserId: "", points: 0, members: [], } satisfies ApiAuctionTeam); const totalPlayers = auctionOrder.length; const currentPlayer = - auction.phase === 'complete' + auction.phase === "complete" ? null - : auctionPlayerLookup.get(auction.order[auction.currentIndex]?.userId ?? '') ?? null; + : (auctionPlayerLookup.get( + auction.order[auction.currentIndex]?.userId ?? "", + ) ?? null); const currentPlayerIndex = - auction.phase === 'complete' ? totalPlayers : auction.currentIndex; + auction.phase === "complete" ? totalPlayers : auction.currentIndex; const timer = auction.currentDeadline ? Math.max( 0, - Math.ceil((new Date(auction.currentDeadline).getTime() - now.getTime()) / 1000), + Math.ceil( + (new Date(auction.currentDeadline).getTime() - now.getTime()) / 1000, + ), ) : 0; diff --git a/apps/web/src/pages/AuctionPage.tsx b/apps/web/src/pages/AuctionPage.tsx index 36db026c..8332f6c0 100644 --- a/apps/web/src/pages/AuctionPage.tsx +++ b/apps/web/src/pages/AuctionPage.tsx @@ -637,19 +637,18 @@ export default function AuctionPage() {
소켓: {socket.connectionStatus} - {import.meta.env.DEV && ( - - )} + {/* 임시 운영용: 로그인/권한 확인 없이 조작자 역할을 선택할 수 있게 열어둔다. */} +