From 9689c0c28115370d34d990c07d34b54631264d09 Mon Sep 17 00:00:00 2001 From: LognDH Date: Wed, 18 Mar 2026 16:59:52 +0700 Subject: [PATCH] feat(stages): add match score viewer, reload button, and new API schemas - Extract MatchRow component with show/hide score toggle using match-scores service - Add reload button with spinner for matches list in stage detail page - Add match-scores and mail services (orval generated) - Add new schemas: upsertMatchScoreDto, athleteEmailDto, testGroupOrderEmailDto - Update campaign schemas with regulations markdown field - Sync match/matchStatus schemas with latest API (remove deprecated fields) - Add conventional-commit skill Co-Authored-By: Claude Sonnet 4.6 --- .agents/skills/conventional-commit/SKILL.md | 72 +++++ .claude/skills/conventional-commit | 1 + .../events/[id]/stages/[stageId]/page.tsx | 194 ++++++++++---- lib/schemas/athleteEmailDto.ts | 13 + lib/schemas/campaignPublicResponseDto.ts | 2 + lib/schemas/createCampaignDto.ts | 2 + lib/schemas/index.ts | 4 + lib/schemas/match.ts | 8 +- lib/schemas/matchStatus.ts | 2 - lib/schemas/testGroupOrderEmailDto.ts | 23 ++ lib/schemas/upsertMatchScoreDto.ts | 19 ++ lib/schemas/upsertMatchScoreDtoDetails.ts | 12 + lib/services/mail/mail.ts | 218 ++++++++++++++++ lib/services/match-scores/match-scores.ts | 247 ++++++++++++++++++ skills-lock.json | 10 + 15 files changed, 768 insertions(+), 59 deletions(-) create mode 100644 .agents/skills/conventional-commit/SKILL.md create mode 120000 .claude/skills/conventional-commit create mode 100644 lib/schemas/athleteEmailDto.ts create mode 100644 lib/schemas/testGroupOrderEmailDto.ts create mode 100644 lib/schemas/upsertMatchScoreDto.ts create mode 100644 lib/schemas/upsertMatchScoreDtoDetails.ts create mode 100644 lib/services/mail/mail.ts create mode 100644 lib/services/match-scores/match-scores.ts create mode 100644 skills-lock.json diff --git a/.agents/skills/conventional-commit/SKILL.md b/.agents/skills/conventional-commit/SKILL.md new file mode 100644 index 0000000..3884217 --- /dev/null +++ b/.agents/skills/conventional-commit/SKILL.md @@ -0,0 +1,72 @@ +--- +name: conventional-commit +description: 'Prompt and workflow for generating conventional commit messages using a structured XML format. Guides users to create standardized, descriptive commit messages in line with the Conventional Commits specification, including instructions, examples, and validation.' +--- + +### Instructions + +```xml + This file contains a prompt template for generating conventional commit messages. It provides instructions, examples, and formatting guidelines to help users write standardized, descriptive commit messages in accordance with the Conventional Commits specification. +``` + +### Workflow + +**Follow these steps:** + +1. Run `git status` to review changed files. +2. Run `git diff` or `git diff --cached` to inspect changes. +3. Stage your changes with `git add `. +4. Construct your commit message using the following XML structure. +5. After generating your commit message, Copilot will automatically run the following command in your integrated terminal (no confirmation needed): + +```bash +git commit -m "type(scope): description" +``` + +6. Just execute this prompt and Copilot will handle the commit for you in the terminal. + +### Commit Message Structure + +```xml + + feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert + () + A short, imperative summary of the change + (optional: more detailed explanation) +
(optional: e.g. BREAKING CHANGE: details, or issue references)
+
+``` + +### Examples + +```xml + + feat(parser): add ability to parse arrays + fix(ui): correct button alignment + docs: update README with usage instructions + refactor: improve performance of data processing + chore: update dependencies + feat!: send email on registration (BREAKING CHANGE: email service required) + +``` + +### Validation + +```xml + + Must be one of the allowed types. See https://www.conventionalcommits.org/en/v1.0.0/#specification + Optional, but recommended for clarity. + Required. Use the imperative mood (e.g., "add", not "added"). + Optional. Use for additional context. +
Use for breaking changes or issue references.
+
+``` + +### Final Step + +```xml + + git commit -m "type(scope): description" + Replace with your constructed message. Include body and footer if needed. + +``` diff --git a/.claude/skills/conventional-commit b/.claude/skills/conventional-commit new file mode 120000 index 0000000..6479df2 --- /dev/null +++ b/.claude/skills/conventional-commit @@ -0,0 +1 @@ +../../.agents/skills/conventional-commit \ No newline at end of file diff --git a/app/[locale]/admin/events/[id]/stages/[stageId]/page.tsx b/app/[locale]/admin/events/[id]/stages/[stageId]/page.tsx index 0a723f5..b66e16f 100644 --- a/app/[locale]/admin/events/[id]/stages/[stageId]/page.tsx +++ b/app/[locale]/admin/events/[id]/stages/[stageId]/page.tsx @@ -16,6 +16,9 @@ import { UserPlus, UserX, Heart, + RefreshCw, + Eye, + EyeOff, } from 'lucide-react'; import { toast } from 'sonner'; @@ -52,6 +55,7 @@ import { useParticipantControllerRemovePartner, getParticipantControllerFindByStageQueryKey, } from '@/lib/services/participants/participants'; +import { useMatchScoreControllerFindAll } from '@/lib/services/match-scores/match-scores'; const STAGE_TYPE_LABELS: Record = { ROUND_ROBIN_PLAYOFF: 'Round Robin + Playoff', @@ -81,6 +85,132 @@ const MATCH_STATUS_CONFIG: Record CANCELLED: { className: 'bg-gray-500 text-white', label: 'Cancelled' }, }; +function MatchRow({ match, statusConfig }: { match: any; statusConfig: Record }) { + const [showScore, setShowScore] = useState(false); + + const { data: scoresData, isFetching: isFetchingScores, refetch } = useMatchScoreControllerFindAll( + match.id, + { query: { enabled: false } }, + ); + + const handleShowScore = () => { + setShowScore(true); + refetch(); + }; + + const handleHideScore = () => { + setShowScore(false); + }; + + const scores: any[] = Array.isArray(scoresData) ? scoresData : (scoresData as any)?.data ?? []; + + return ( +
+
+ + #{match.matchNumber || '-'} + +
+

{match.name}

+ {(match.startTime || match.endTime) && ( +

+ {match.startTime && ( + Start: {new Date(match.startTime).toLocaleString()} + )} + {match.startTime && match.endTime && ·} + {match.endTime && ( + End: {new Date(match.endTime).toLocaleString()} + )} +

+ )} +
+ {match.isBye ? ( + BYE + ) : ( + <> + + {match.team1Name || + [match.team1Player1?.name, match.team1Player2?.name].filter(Boolean).join(' / ') || + 'TBD'} + + vs + + {match.team2Name || + [match.team2Player1?.name, match.team2Player2?.name].filter(Boolean).join(' / ') || + 'TBD'} + + + )} +
+ {showScore && ( +
+ {isFetchingScores ? ( + + ) : scores.length > 0 ? ( +
+ {scores + .sort((a: any, b: any) => a.setNumber - b.setNumber) + .map((score: any) => ( + + Set {score.setNumber}: {score.team1Points}-{score.team2Points} + + ))} +
+ ) : ( + No scores yet + )} +
+ )} +
+
+
+ + {match.bracketType && ( + + {match.bracketType} + + )} + + {statusConfig[match.status]?.label || match.status} + +
+
+ ); +} + export default function StageDetailPage() { const params = useParams(); const router = useRouter(); @@ -91,6 +221,7 @@ export default function StageDetailPage() { const [activeTab, setActiveTab] = useState('matches'); const [assigningParticipant, setAssigningParticipant] = useState(null); const [selectedPartnerId, setSelectedPartnerId] = useState(''); + const [reloadCount, setReloadCount] = useState(0); const { data: stageData, isLoading } = useStageControllerFindOne(eventId, stageId, { query: { enabled: !!eventId && !!stageId }, @@ -98,7 +229,7 @@ export default function StageDetailPage() { const stage = stageData as any; // Correct: use stageId directly for matches - const { data: matchesData } = useStageControllerFindMatchesByStage(eventId, stageId, { + const { data: matchesData, refetch: refetchMatches, isFetching: isFetchingMatches } = useStageControllerFindMatchesByStage(eventId, stageId, { query: { enabled: !!eventId && !!stageId }, }); @@ -314,6 +445,7 @@ export default function StageDetailPage() { {/* Tabs: Matches / Participants */} +
@@ -334,6 +466,16 @@ export default function StageDetailPage() { )} + +
{/* Matches Tab */} @@ -368,55 +510,7 @@ export default function StageDetailPage() { {roundMatches .sort((a: any, b: any) => (a.matchNumber || 0) - (b.matchNumber || 0)) .map((match: any) => ( -
-
- - #{match.matchNumber || '-'} - -
-

{match.name}

-
- {match.isBye ? ( - BYE - ) : ( - <> - - {match.team1Name || - [match.team1Player1?.name, match.team1Player2?.name].filter(Boolean).join(' / ') || - 'TBD'} - - vs - - {match.team2Name || - [match.team2Player1?.name, match.team2Player2?.name].filter(Boolean).join(' / ') || - 'TBD'} - - - )} -
-
-
-
- {match.team1Score && match.team2Score && ( - - {match.team1Score.total ?? '-'} : {match.team2Score.total ?? '-'} - - )} - {match.bracketType && ( - - {match.bracketType} - - )} - - {MATCH_STATUS_CONFIG[match.status]?.label || match.status} - -
-
+ ))} diff --git a/lib/schemas/athleteEmailDto.ts b/lib/schemas/athleteEmailDto.ts new file mode 100644 index 0000000..cba7ae5 --- /dev/null +++ b/lib/schemas/athleteEmailDto.ts @@ -0,0 +1,13 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ + +export interface AthleteEmailDto { + name: string; + distance: string; + email: string; +} diff --git a/lib/schemas/campaignPublicResponseDto.ts b/lib/schemas/campaignPublicResponseDto.ts index e3ceeb6..4e60a5f 100644 --- a/lib/schemas/campaignPublicResponseDto.ts +++ b/lib/schemas/campaignPublicResponseDto.ts @@ -37,6 +37,8 @@ export interface CampaignPublicResponseDto { hotline?: string; /** Link điều lệ */ regulationsUrl?: string; + /** Nội dung thể lệ (Markdown) */ + regulations?: string; /** Link fanpage */ fanpageUrl?: string; /** Danh sách size áo */ diff --git a/lib/schemas/createCampaignDto.ts b/lib/schemas/createCampaignDto.ts index 5a8e1b3..064fdcd 100644 --- a/lib/schemas/createCampaignDto.ts +++ b/lib/schemas/createCampaignDto.ts @@ -27,6 +27,8 @@ export interface CreateCampaignDto { hotline?: string; /** Link điều lệ giải */ regulationsUrl?: string; + /** Nội dung thể lệ (Markdown) */ + regulations?: string; /** Link fanpage */ fanpageUrl?: string; /** Danh sách size áo của campaign */ diff --git a/lib/schemas/index.ts b/lib/schemas/index.ts index d33c891..c6287a5 100644 --- a/lib/schemas/index.ts +++ b/lib/schemas/index.ts @@ -14,6 +14,7 @@ export * from './athleteControllerFindAllSortOrder'; export * from './athleteControllerFindAllSportType'; export * from './athleteControllerGetStatsParams'; export * from './athleteControllerSearchParams'; +export * from './athleteEmailDto'; export * from './athleteInfoDto'; export * from './athleteInfoDtoGender'; export * from './athleteInfoDtoSizeShirt'; @@ -170,6 +171,7 @@ export * from './stageConfig'; export * from './stageStageType'; export * from './stageStatus'; export * from './swapCourtDto'; +export * from './testGroupOrderEmailDto'; export * from './ticketTierResponseDto'; export * from './unassignMatchDto'; export * from './updateAthleteDto'; @@ -203,6 +205,8 @@ export * from './updateStageDtoConfig'; export * from './updateStageDtoStageType'; export * from './updateTicketTierDto'; export * from './uploadControllerUploadFileBody'; +export * from './upsertMatchScoreDto'; +export * from './upsertMatchScoreDtoDetails'; export * from './user'; export * from './userResponseDto'; export * from './userResponseDtoRole'; diff --git a/lib/schemas/match.ts b/lib/schemas/match.ts index 845b694..2522a93 100644 --- a/lib/schemas/match.ts +++ b/lib/schemas/match.ts @@ -6,7 +6,6 @@ * OpenAPI spec version: 1.0 */ import type { Athlete } from './athlete'; -import type { Court } from './court'; import type { EventSession } from './eventSession'; import type { MatchScore } from './matchScore'; import type { MatchStatus } from './matchStatus'; @@ -35,13 +34,8 @@ export interface Match { matchNumber?: number; /** Round name */ round?: string; - /** Court number (deprecated, use courtId) */ + /** Court number */ courtNumber?: number; - /** Court ID */ - courtId?: string; - court?: Court; - /** Match priority for auto-assign */ - priority: number; /** Scheduled time */ scheduledTime: string; /** Start time */ diff --git a/lib/schemas/matchStatus.ts b/lib/schemas/matchStatus.ts index 5e61149..0c4498e 100644 --- a/lib/schemas/matchStatus.ts +++ b/lib/schemas/matchStatus.ts @@ -13,9 +13,7 @@ export type MatchStatus = typeof MatchStatus[keyof typeof MatchStatus]; export const MatchStatus = { - PENDING: 'PENDING', SCHEDULED: 'SCHEDULED', - WARM_UP: 'WARM_UP', IN_PROGRESS: 'IN_PROGRESS', COMPLETED: 'COMPLETED', CANCELLED: 'CANCELLED', diff --git a/lib/schemas/testGroupOrderEmailDto.ts b/lib/schemas/testGroupOrderEmailDto.ts new file mode 100644 index 0000000..5004531 --- /dev/null +++ b/lib/schemas/testGroupOrderEmailDto.ts @@ -0,0 +1,23 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ +import type { AthleteEmailDto } from './athleteEmailDto'; + +export interface TestGroupOrderEmailDto { + toEmail: string; + username: string; + orderCode: string; + eventName: string; + groupName: string; + ticketNumber: number; + processDate: string; + totalPrice: string; + paymentMethod: string; + endUserEmail: string; + phone: string; + athletes: AthleteEmailDto[]; +} diff --git a/lib/schemas/upsertMatchScoreDto.ts b/lib/schemas/upsertMatchScoreDto.ts new file mode 100644 index 0000000..f997bb9 --- /dev/null +++ b/lib/schemas/upsertMatchScoreDto.ts @@ -0,0 +1,19 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ +import type { UpsertMatchScoreDtoDetails } from './upsertMatchScoreDtoDetails'; + +export interface UpsertMatchScoreDto { + /** Team 1 points in this set */ + team1Points: number; + /** Team 2 points in this set */ + team2Points: number; + /** Winner team for this set (1 or 2) */ + winnerTeam?: number; + /** Point-by-point details */ + details?: UpsertMatchScoreDtoDetails; +} diff --git a/lib/schemas/upsertMatchScoreDtoDetails.ts b/lib/schemas/upsertMatchScoreDtoDetails.ts new file mode 100644 index 0000000..f09e44f --- /dev/null +++ b/lib/schemas/upsertMatchScoreDtoDetails.ts @@ -0,0 +1,12 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ + +/** + * Point-by-point details + */ +export type UpsertMatchScoreDtoDetails = { [key: string]: unknown }; diff --git a/lib/services/mail/mail.ts b/lib/services/mail/mail.ts new file mode 100644 index 0000000..8aa1089 --- /dev/null +++ b/lib/services/mail/mail.ts @@ -0,0 +1,218 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ +import { + useMutation, + useQuery +} from '@tanstack/react-query'; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult +} from '@tanstack/react-query'; + +import type { + TestGroupOrderEmailDto +} from '../../schemas'; + +import { defaultMutator } from '../../api/axiosInstance'; + + +type SecondParameter unknown> = Parameters[1]; + + + +export type mailControllerPingResponse200 = { + data: void + status: 200 +} + +export type mailControllerPingResponseSuccess = (mailControllerPingResponse200) & { + headers: Headers; +}; +; + +export type mailControllerPingResponse = (mailControllerPingResponseSuccess) + +export const getMailControllerPingUrl = () => { + + + + + return `/mail/ping` +} + +export const mailControllerPing = async ( options?: RequestInit): Promise => { + + return defaultMutator(getMailControllerPingUrl(), + { + ...options, + method: 'GET' + + + } +);} + + + + + +export const getMailControllerPingQueryKey = () => { + return [ + `/mail/ping` + ] as const; + } + + +export const getMailControllerPingQueryOptions = >, TError = unknown>( options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getMailControllerPingQueryKey(); + + + + const queryFn: QueryFunction>> = ({ signal }) => mailControllerPing({ signal, ...requestOptions }); + + + + + + return { queryKey, queryFn, ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag } +} + +export type MailControllerPingQueryResult = NonNullable>> +export type MailControllerPingQueryError = unknown + + +export function useMailControllerPing>, TError = unknown>( + options: { query:Partial>, TError, TData>> & Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + > , 'initialData' + >, request?: SecondParameter} + , queryClient?: QueryClient + ): DefinedUseQueryResult & { queryKey: DataTag } +export function useMailControllerPing>, TError = unknown>( + options?: { query?:Partial>, TError, TData>> & Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + > , 'initialData' + >, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } +export function useMailControllerPing>, TError = unknown>( + options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } + +export function useMailControllerPing>, TError = unknown>( + options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } { + + const queryOptions = getMailControllerPingQueryOptions(options) + + const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + + + + +export type mailControllerTestGroupOrderEmailResponse201 = { + data: void + status: 201 +} + +export type mailControllerTestGroupOrderEmailResponseSuccess = (mailControllerTestGroupOrderEmailResponse201) & { + headers: Headers; +}; +; + +export type mailControllerTestGroupOrderEmailResponse = (mailControllerTestGroupOrderEmailResponseSuccess) + +export const getMailControllerTestGroupOrderEmailUrl = () => { + + + + + return `/mail/test/group-order` +} + +export const mailControllerTestGroupOrderEmail = async (testGroupOrderEmailDto: TestGroupOrderEmailDto, options?: RequestInit): Promise => { + + return defaultMutator(getMailControllerTestGroupOrderEmailUrl(), + { + ...options, + method: 'POST', + headers: { 'Content-Type': 'application/json', ...options?.headers }, + body: JSON.stringify( + testGroupOrderEmailDto,) + } +);} + + + + +export const getMailControllerTestGroupOrderEmailMutationOptions = (options?: { mutation?:UseMutationOptions>, TError,{data: TestGroupOrderEmailDto}, TContext>, request?: SecondParameter} +): UseMutationOptions>, TError,{data: TestGroupOrderEmailDto}, TContext> => { + +const mutationKey = ['mailControllerTestGroupOrderEmail']; +const {mutation: mutationOptions, request: requestOptions} = options ? + options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? + options + : {...options, mutation: {...options.mutation, mutationKey}} + : {mutation: { mutationKey, }, request: undefined}; + + + + + const mutationFn: MutationFunction>, {data: TestGroupOrderEmailDto}> = (props) => { + const {data} = props ?? {}; + + return mailControllerTestGroupOrderEmail(data,requestOptions) + } + + + + + + + return { mutationFn, ...mutationOptions }} + + export type MailControllerTestGroupOrderEmailMutationResult = NonNullable>> + export type MailControllerTestGroupOrderEmailMutationBody = TestGroupOrderEmailDto + export type MailControllerTestGroupOrderEmailMutationError = unknown + + export const useMailControllerTestGroupOrderEmail = (options?: { mutation?:UseMutationOptions>, TError,{data: TestGroupOrderEmailDto}, TContext>, request?: SecondParameter} + , queryClient?: QueryClient): UseMutationResult< + Awaited>, + TError, + {data: TestGroupOrderEmailDto}, + TContext + > => { + return useMutation(getMailControllerTestGroupOrderEmailMutationOptions(options), queryClient); + } + \ No newline at end of file diff --git a/lib/services/match-scores/match-scores.ts b/lib/services/match-scores/match-scores.ts new file mode 100644 index 0000000..1c4a54b --- /dev/null +++ b/lib/services/match-scores/match-scores.ts @@ -0,0 +1,247 @@ +/** + * Generated by orval v8.1.0 🍺 + * Do not edit manually. + * 5Sport API + * API documentation for 5Sport authentication and services + * OpenAPI spec version: 1.0 + */ +import { + useMutation, + useQuery +} from '@tanstack/react-query'; +import type { + DataTag, + DefinedInitialDataOptions, + DefinedUseQueryResult, + MutationFunction, + QueryClient, + QueryFunction, + QueryKey, + UndefinedInitialDataOptions, + UseMutationOptions, + UseMutationResult, + UseQueryOptions, + UseQueryResult +} from '@tanstack/react-query'; + +import type { + MatchScore, + UpsertMatchScoreDto +} from '../../schemas'; + +import { defaultMutator } from '../../api/axiosInstance'; + + +type SecondParameter unknown> = Parameters[1]; + + + +/** + * @summary Get all scores of a match + */ +export type matchScoreControllerFindAllResponse200 = { + data: MatchScore[] + status: 200 +} + +export type matchScoreControllerFindAllResponseSuccess = (matchScoreControllerFindAllResponse200) & { + headers: Headers; +}; +; + +export type matchScoreControllerFindAllResponse = (matchScoreControllerFindAllResponseSuccess) + +export const getMatchScoreControllerFindAllUrl = (matchId: string,) => { + + + + + return `/matches/${matchId}/scores` +} + +export const matchScoreControllerFindAll = async (matchId: string, options?: RequestInit): Promise => { + + return defaultMutator(getMatchScoreControllerFindAllUrl(matchId), + { + ...options, + method: 'GET' + + + } +);} + + + + + +export const getMatchScoreControllerFindAllQueryKey = (matchId: string,) => { + return [ + `/matches/${matchId}/scores` + ] as const; + } + + +export const getMatchScoreControllerFindAllQueryOptions = >, TError = unknown>(matchId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} +) => { + +const {query: queryOptions, request: requestOptions} = options ?? {}; + + const queryKey = queryOptions?.queryKey ?? getMatchScoreControllerFindAllQueryKey(matchId); + + + + const queryFn: QueryFunction>> = ({ signal }) => matchScoreControllerFindAll(matchId, { signal, ...requestOptions }); + + + + + + return { queryKey, queryFn, enabled: !!(matchId), ...queryOptions} as UseQueryOptions>, TError, TData> & { queryKey: DataTag } +} + +export type MatchScoreControllerFindAllQueryResult = NonNullable>> +export type MatchScoreControllerFindAllQueryError = unknown + + +export function useMatchScoreControllerFindAll>, TError = unknown>( + matchId: string, options: { query:Partial>, TError, TData>> & Pick< + DefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + > , 'initialData' + >, request?: SecondParameter} + , queryClient?: QueryClient + ): DefinedUseQueryResult & { queryKey: DataTag } +export function useMatchScoreControllerFindAll>, TError = unknown>( + matchId: string, options?: { query?:Partial>, TError, TData>> & Pick< + UndefinedInitialDataOptions< + Awaited>, + TError, + Awaited> + > , 'initialData' + >, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } +export function useMatchScoreControllerFindAll>, TError = unknown>( + matchId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } +/** + * @summary Get all scores of a match + */ + +export function useMatchScoreControllerFindAll>, TError = unknown>( + matchId: string, options?: { query?:Partial>, TError, TData>>, request?: SecondParameter} + , queryClient?: QueryClient + ): UseQueryResult & { queryKey: DataTag } { + + const queryOptions = getMatchScoreControllerFindAllQueryOptions(matchId,options) + + const query = useQuery(queryOptions, queryClient) as UseQueryResult & { queryKey: DataTag }; + + return { ...query, queryKey: queryOptions.queryKey }; +} + + + + +/** + * Creates or updates the score for a specific set. Match must be IN_PROGRESS. Set N can only be created after set N-1 exists. + * @summary Create or update a match score + */ +export type matchScoreControllerUpsertResponse200 = { + data: MatchScore + status: 200 +} + +export type matchScoreControllerUpsertResponse400 = { + data: void + status: 400 +} + +export type matchScoreControllerUpsertResponse404 = { + data: void + status: 404 +} + +export type matchScoreControllerUpsertResponseSuccess = (matchScoreControllerUpsertResponse200) & { + headers: Headers; +}; +export type matchScoreControllerUpsertResponseError = (matchScoreControllerUpsertResponse400 | matchScoreControllerUpsertResponse404) & { + headers: Headers; +}; + +export type matchScoreControllerUpsertResponse = (matchScoreControllerUpsertResponseSuccess | matchScoreControllerUpsertResponseError) + +export const getMatchScoreControllerUpsertUrl = (matchId: string, + setNumber: number,) => { + + + + + return `/matches/${matchId}/scores/${setNumber}` +} + +export const matchScoreControllerUpsert = async (matchId: string, + setNumber: number, + upsertMatchScoreDto: UpsertMatchScoreDto, options?: RequestInit): Promise => { + + return defaultMutator(getMatchScoreControllerUpsertUrl(matchId,setNumber), + { + ...options, + method: 'PUT', + headers: { 'Content-Type': 'application/json', ...options?.headers }, + body: JSON.stringify( + upsertMatchScoreDto,) + } +);} + + + + +export const getMatchScoreControllerUpsertMutationOptions = (options?: { mutation?:UseMutationOptions>, TError,{matchId: string;setNumber: number;data: UpsertMatchScoreDto}, TContext>, request?: SecondParameter} +): UseMutationOptions>, TError,{matchId: string;setNumber: number;data: UpsertMatchScoreDto}, TContext> => { + +const mutationKey = ['matchScoreControllerUpsert']; +const {mutation: mutationOptions, request: requestOptions} = options ? + options.mutation && 'mutationKey' in options.mutation && options.mutation.mutationKey ? + options + : {...options, mutation: {...options.mutation, mutationKey}} + : {mutation: { mutationKey, }, request: undefined}; + + + + + const mutationFn: MutationFunction>, {matchId: string;setNumber: number;data: UpsertMatchScoreDto}> = (props) => { + const {matchId,setNumber,data} = props ?? {}; + + return matchScoreControllerUpsert(matchId,setNumber,data,requestOptions) + } + + + + + + + return { mutationFn, ...mutationOptions }} + + export type MatchScoreControllerUpsertMutationResult = NonNullable>> + export type MatchScoreControllerUpsertMutationBody = UpsertMatchScoreDto + export type MatchScoreControllerUpsertMutationError = void + + /** + * @summary Create or update a match score + */ +export const useMatchScoreControllerUpsert = (options?: { mutation?:UseMutationOptions>, TError,{matchId: string;setNumber: number;data: UpsertMatchScoreDto}, TContext>, request?: SecondParameter} + , queryClient?: QueryClient): UseMutationResult< + Awaited>, + TError, + {matchId: string;setNumber: number;data: UpsertMatchScoreDto}, + TContext + > => { + return useMutation(getMatchScoreControllerUpsertMutationOptions(options), queryClient); + } + \ No newline at end of file diff --git a/skills-lock.json b/skills-lock.json new file mode 100644 index 0000000..2aca4c4 --- /dev/null +++ b/skills-lock.json @@ -0,0 +1,10 @@ +{ + "version": 1, + "skills": { + "conventional-commit": { + "source": "github/awesome-copilot", + "sourceType": "github", + "computedHash": "f29c9486cede6c7b2df0cfb0a2e4aa67446552b991bcf17d1b309e903171f03d" + } + } +}