refactor page to use services
This commit is contained in:
@@ -198,171 +198,6 @@
|
||||
"contactEmail"
|
||||
]
|
||||
},
|
||||
"UpdatePaymentStatusInputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"paymentId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"paymentId"
|
||||
]
|
||||
},
|
||||
"PaymentDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"MembershipFeeDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId"
|
||||
]
|
||||
},
|
||||
"MemberPaymentDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"feeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
},
|
||||
"platformFee": {
|
||||
"type": "number"
|
||||
},
|
||||
"netAmount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"feeId",
|
||||
"driverId",
|
||||
"amount",
|
||||
"platformFee",
|
||||
"netAmount"
|
||||
]
|
||||
},
|
||||
"PrizeDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
},
|
||||
"seasonId": {
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"type": "number"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId",
|
||||
"seasonId",
|
||||
"position",
|
||||
"name",
|
||||
"amount"
|
||||
]
|
||||
},
|
||||
"WalletDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
},
|
||||
"balance": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalRevenue": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalPlatformFees": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalWithdrawn": {
|
||||
"type": "number"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId",
|
||||
"balance",
|
||||
"totalRevenue",
|
||||
"totalPlatformFees",
|
||||
"totalWithdrawn",
|
||||
"createdAt",
|
||||
"currency"
|
||||
]
|
||||
},
|
||||
"TransactionDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"walletId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"walletId"
|
||||
]
|
||||
},
|
||||
"PaymentDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"WithdrawFromRaceParamsDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1058,6 +893,297 @@
|
||||
"suitColor"
|
||||
]
|
||||
},
|
||||
"UpdatePaymentStatusInputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"paymentId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"paymentId"
|
||||
]
|
||||
},
|
||||
"PaymentDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"MembershipFeeDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId"
|
||||
]
|
||||
},
|
||||
"MemberPaymentDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"feeId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
},
|
||||
"platformFee": {
|
||||
"type": "number"
|
||||
},
|
||||
"netAmount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"feeId",
|
||||
"driverId",
|
||||
"amount",
|
||||
"platformFee",
|
||||
"netAmount"
|
||||
]
|
||||
},
|
||||
"PrizeDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
},
|
||||
"seasonId": {
|
||||
"type": "string"
|
||||
},
|
||||
"position": {
|
||||
"type": "number"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId",
|
||||
"seasonId",
|
||||
"position",
|
||||
"name",
|
||||
"amount"
|
||||
]
|
||||
},
|
||||
"WalletDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"leagueId": {
|
||||
"type": "string"
|
||||
},
|
||||
"balance": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalRevenue": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalPlatformFees": {
|
||||
"type": "number"
|
||||
},
|
||||
"totalWithdrawn": {
|
||||
"type": "number"
|
||||
},
|
||||
"createdAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"currency": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"leagueId",
|
||||
"balance",
|
||||
"totalRevenue",
|
||||
"totalPlatformFees",
|
||||
"totalWithdrawn",
|
||||
"createdAt",
|
||||
"currency"
|
||||
]
|
||||
},
|
||||
"TransactionDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"walletId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"walletId"
|
||||
]
|
||||
},
|
||||
"PaymentDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
"GetDriverRegistrationStatusQueryDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"raceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"raceId",
|
||||
"driverId"
|
||||
]
|
||||
},
|
||||
"DriverStatsDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"totalDrivers": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"totalDrivers"
|
||||
]
|
||||
},
|
||||
"DriverRegistrationStatusDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"isRegistered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"raceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"isRegistered",
|
||||
"raceId",
|
||||
"driverId"
|
||||
]
|
||||
},
|
||||
"DriverLeaderboardItemDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating": {
|
||||
"type": "number"
|
||||
},
|
||||
"skillLevel": {
|
||||
"type": "string"
|
||||
},
|
||||
"nationality": {
|
||||
"type": "string"
|
||||
},
|
||||
"racesCompleted": {
|
||||
"type": "number"
|
||||
},
|
||||
"wins": {
|
||||
"type": "number"
|
||||
},
|
||||
"podiums": {
|
||||
"type": "number"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"rank": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"rating",
|
||||
"skillLevel",
|
||||
"nationality",
|
||||
"racesCompleted",
|
||||
"wins",
|
||||
"podiums",
|
||||
"isActive",
|
||||
"rank"
|
||||
]
|
||||
},
|
||||
"CompleteOnboardingOutputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"success"
|
||||
]
|
||||
},
|
||||
"CompleteOnboardingInputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"firstName": {
|
||||
"type": "string"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"displayName": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"displayName",
|
||||
"country"
|
||||
]
|
||||
},
|
||||
"UpdateLeagueMemberRoleOutputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -1525,132 +1651,6 @@
|
||||
"leagueId"
|
||||
]
|
||||
},
|
||||
"GetDriverRegistrationStatusQueryDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"raceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"raceId",
|
||||
"driverId"
|
||||
]
|
||||
},
|
||||
"DriverStatsDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"totalDrivers": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"totalDrivers"
|
||||
]
|
||||
},
|
||||
"DriverRegistrationStatusDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"isRegistered": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"raceId": {
|
||||
"type": "string"
|
||||
},
|
||||
"driverId": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"isRegistered",
|
||||
"raceId",
|
||||
"driverId"
|
||||
]
|
||||
},
|
||||
"DriverLeaderboardItemDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"rating": {
|
||||
"type": "number"
|
||||
},
|
||||
"skillLevel": {
|
||||
"type": "string"
|
||||
},
|
||||
"nationality": {
|
||||
"type": "string"
|
||||
},
|
||||
"racesCompleted": {
|
||||
"type": "number"
|
||||
},
|
||||
"wins": {
|
||||
"type": "number"
|
||||
},
|
||||
"podiums": {
|
||||
"type": "number"
|
||||
},
|
||||
"isActive": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"rank": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"id",
|
||||
"name",
|
||||
"rating",
|
||||
"skillLevel",
|
||||
"nationality",
|
||||
"racesCompleted",
|
||||
"wins",
|
||||
"podiums",
|
||||
"isActive",
|
||||
"rank"
|
||||
]
|
||||
},
|
||||
"CompleteOnboardingOutputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"success": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"success"
|
||||
]
|
||||
},
|
||||
"CompleteOnboardingInputDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"firstName": {
|
||||
"type": "string"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string"
|
||||
},
|
||||
"displayName": {
|
||||
"type": "string"
|
||||
},
|
||||
"country": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"firstName",
|
||||
"lastName",
|
||||
"displayName",
|
||||
"country"
|
||||
]
|
||||
},
|
||||
"AuthenticatedUserDTO": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -153,6 +153,37 @@ export class LeagueController {
|
||||
return this.leagueService.getLeagueProtests(query);
|
||||
}
|
||||
|
||||
@Get(':leagueId/protests/:protestId')
|
||||
@ApiOperation({ summary: 'Get a specific protest for a league' })
|
||||
@ApiResponse({ status: 200, description: 'Protest details', type: LeagueAdminProtestsDTO })
|
||||
async getLeagueProtest(
|
||||
@Param('leagueId') leagueId: string,
|
||||
@Param('protestId') protestId: string,
|
||||
): Promise<LeagueAdminProtestsDTO> {
|
||||
const query: GetLeagueProtestsQuery = { leagueId };
|
||||
const allProtests = await this.leagueService.getLeagueProtests(query);
|
||||
|
||||
// Filter to only include the specific protest
|
||||
const protest = allProtests.protests.find(p => p.id === protestId);
|
||||
if (!protest) {
|
||||
throw new Error('Protest not found');
|
||||
}
|
||||
|
||||
// Find the race for this protest
|
||||
const race = allProtests.racesById[protest.raceId];
|
||||
const protestingDriver = allProtests.driversById[protest.protestingDriverId];
|
||||
const accusedDriver = allProtests.driversById[protest.accusedDriverId];
|
||||
|
||||
return {
|
||||
protests: [protest],
|
||||
racesById: race ? { [race.id]: race } : {},
|
||||
driversById: {
|
||||
...(protestingDriver ? { [protestingDriver.id]: protestingDriver } : {}),
|
||||
...(accusedDriver ? { [accusedDriver.id]: accusedDriver } : {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@Get(':leagueId/seasons')
|
||||
@ApiOperation({ summary: 'Get seasons for a league' })
|
||||
@ApiResponse({ status: 200, description: 'List of seasons for the league', type: [LeagueSeasonSummaryDTO] })
|
||||
|
||||
Reference in New Issue
Block a user