AI Review Center
Commit Review Workspace ?
Select a commit on the left to inspect quality, security, business value, findings, and suggested code changes.
Project AI Score
?
72%
Quality Avg
?
77%
Security Avg
?
64%
Reviews
?
91
Review Result ?
solutionbowl/super-admin · f91e0d8f
The commit introduces agent-specific bet view functionality with query validation and conditional data fetching to enhance user experience. It improves business value by supporting new agent mode views, but some validation and security improvements are needed to reduce risk.
Quality
?
85%
Security
?
60%
Business Value
?
80%
Maintainability
?
83%
Issues & Suggested Fixes
?
1AI detects the issue
2Shows file, line, or evidence
3Suggests the fix to apply
Missing Validation
Where
src/routes/bet-list.tsx:25
Issue / Evidence
improve search parameter validation
Suggested Fix
add stricter validation or schema validation to prevent invalid data injection
Potential Query Parameter Injection Risk
Where
src/services/api/internalServices.ts:560
Issue / Evidence
potential query parameter injection risk
Suggested Fix
use query parameter encoding libraries consistently to prevent injection beyond encodeURIComponent
Improve Type Safety When Accessing Agentbe...
Where
src/routes/bet-list.tsx:105
Issue / Evidence
improve type safety when accessing agentBetsQuery data
Suggested Fix
add more explicit type checks to prevent runtime errors
Consider Adding Error Handling Or Fallback...
Where
src/routes/bet-list.tsx:90
Issue / Evidence
consider adding error handling or fallback UI for agent mode disabled requests
Suggested Fix
enhance robustness
Vague Description
Where
commit message
Issue / Evidence
vague description
Suggested Fix
provide more detailed commit message explaining purpose and impact of changes
Code Change Preview · src/routes/bet-list.tsx
?
Removed / Before Commit
- diff --git a/src/routes/bet-list.tsx b/src/routes/bet-list.tsx - index fffba32..b66077b 100644 - import { createFileRoute, useNavigate } from "@tanstack/react-router"; - import { useQuery } from "@tanstack/react-query"; - import TablePagination from "@/components/common/TablePagination"; - import { format } from "date-fns"; - export const Route = createFileRoute("/bet-list")({ - component: BetListPage, - head: () => ({ meta: [{ title: "Bets List - B2B-B2C Panel" }] }), - }); - - const tableColumns = [ - ] as const; - - function BetListPage() { - const [dateRange, setDateRange] = useState<DateRange | undefined>(); - const [currentPage, setCurrentPage] = useState(1); - const [pageInput, setPageInput] = useState("1");
Added / After Commit
+ diff --git a/src/routes/bet-list.tsx b/src/routes/bet-list.tsx + index fffba32..b66077b 100644 + import { createFileRoute, useNavigate, useSearch } from "@tanstack/react-router"; + import { useQuery } from "@tanstack/react-query"; + import TablePagination from "@/components/common/TablePagination"; + import { format } from "date-fns"; + export const Route = createFileRoute("/bet-list")({ + component: BetListPage, + head: () => ({ meta: [{ title: "Bets List - B2B-B2C Panel" }] }), + validateSearch: (search: Record<string, unknown>): { market_id?: string; race_id?: string; agent_id?: string } => ({ + market_id: typeof search.market_id === "string" ? search.market_id : undefined, + race_id: typeof search.race_id === "string" ? search.race_id : undefined, + agent_id: typeof search.agent_id === "string" ? search.agent_id : undefined, + }), + }); + + const tableColumns = [ + ] as const;
Removed / Before Commit
- diff --git a/src/routes/pl-by-agent.tsx b/src/routes/pl-by-agent.tsx - index 190438c..80a51e0 100644 - - function RaceRows({ race }: { race: ProfitLossRaceGroup }) { - const agents = race.agents ?? []; - - return ( - <> - `${agent.agentName}-${index}` - } - agent={agent} - index={index} - /> - )) - ); - } - - function AgentRow({ agent, index }: { agent: ProfitLossAgentRow; index: number }) {
Added / After Commit
+ diff --git a/src/routes/pl-by-agent.tsx b/src/routes/pl-by-agent.tsx + index 190438c..80a51e0 100644 + + function RaceRows({ race }: { race: ProfitLossRaceGroup }) { + const agents = race.agents ?? []; + const raceId = race.raceId ?? race._id ?? race.id ?? ""; + + return ( + <> + `${agent.agentName}-${index}` + } + agent={agent} + raceId={raceId} + index={index} + /> + )) + ); + }
Removed / Before Commit
- diff --git a/src/routes/pl-by-market.tsx b/src/routes/pl-by-market.tsx - index 486d287..fcb2884 100644 - <> - <span> | </span> - <a - href={`/bet-list?marketId=${encodeURIComponent(market.marketId)}`} - className="font-semibold text-violet-700 hover:text-violet-800 hover:underline" - > - View Bets
Added / After Commit
+ diff --git a/src/routes/pl-by-market.tsx b/src/routes/pl-by-market.tsx + index 486d287..fcb2884 100644 + <> + <span> | </span> + <a + href={`/bet-list?market_id=${encodeURIComponent(market.marketId)}`} + className="font-semibold text-violet-700 hover:text-violet-800 hover:underline" + > + View Bets
Removed / Before Commit
- diff --git a/src/services/api/betTypes.ts b/src/services/api/betTypes.ts - index 954632a..c00742c 100644 - bet_status?: string; - fromDate?: string; - toDate?: string; - }
Added / After Commit
+ diff --git a/src/services/api/betTypes.ts b/src/services/api/betTypes.ts + index 954632a..c00742c 100644 + bet_status?: string; + fromDate?: string; + toDate?: string; + market_id?: string; + }
Removed / Before Commit
- diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts - index b95a1a5..96d06b5 100644 - }), - ); - }, - // async multiBetProfitLoss(fromDate: string, toDate: string) { - // return unwrapData( - // await tenantApiClient.get( - bet_status: params.bet_status, - fromDate: params.fromDate, - toDate: params.toDate, - }); - return unwrapData<BetListResponse["data"]>( - await tenantApiClient.get<unknown>(`/horse-racing/reports/bets${queryString}`),
Added / After Commit
+ diff --git a/src/services/api/internalServices.ts b/src/services/api/internalServices.ts + index b95a1a5..96d06b5 100644 + }), + ); + }, + async raceAgentBets(raceId: string, agentId: string) { + return unwrapData<BetListResponse["data"]>( + await tenantApiClient.get<unknown>( + `/horse-racing/reports/race-agent-bets?raceId=${encodeURIComponent(raceId)}&tenantId=${encodeURIComponent(agentId)}`, + ), + ); + }, + // async multiBetProfitLoss(fromDate: string, toDate: string) { + // return unwrapData( + // await tenantApiClient.get( + bet_status: params.bet_status, + fromDate: params.fromDate, + toDate: params.toDate,
Removed / Before Commit
- diff --git a/src/services/api/internalTypes.ts b/src/services/api/internalTypes.ts - index 13f2073..074c979 100644 - - export interface ProfitLossAgentRow extends PanelRecord { - groupId?: string; - agentName?: string; - agentUsername?: string; - username?: string;
Added / After Commit
+ diff --git a/src/services/api/internalTypes.ts b/src/services/api/internalTypes.ts + index 13f2073..074c979 100644 + + export interface ProfitLossAgentRow extends PanelRecord { + groupId?: string; + agentId?: string; + agentName?: string; + agentUsername?: string; + username?: string;