diff --git a/apps/api/openapi.json b/apps/api/openapi.json new file mode 100644 index 000000000..91fefe2e5 --- /dev/null +++ b/apps/api/openapi.json @@ -0,0 +1,2964 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "GridPilot API", + "description": "GridPilot API documentation", + "version": "1.0.0" + }, + "paths": {}, + "components": { + "schemas": { + "SponsorshipPricingItemDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "level": { + "type": "string" + }, + "price": { + "type": "number" + }, + "currency": { + "type": "string" + } + }, + "required": [ + "id", + "level", + "price", + "currency" + ] + }, + "SponsorshipDetailDTO": { + "type": "object", + "properties": { + "createdAt": { + "type": "string", + "format": "date-time" + }, + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "leagueName": { + "type": "string" + }, + "seasonId": { + "type": "string" + }, + "seasonName": { + "type": "string" + }, + "required": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "pricing": { + "type": "string" + }, + "currency": { + "type": "string" + }, + "platformFee": { + "type": "string" + }, + "netAmount": { + "type": "string" + }, + "metrics": { + "type": "string" + }, + "races": { + "type": "number" + }, + "completedRaces": { + "type": "number" + }, + "impressions": { + "type": "number" + } + }, + "required": [ + "createdAt", + "id", + "leagueId", + "leagueName", + "seasonId", + "seasonName", + "required", + "enum", + "pricing", + "currency", + "platformFee", + "netAmount", + "metrics", + "races", + "completedRaces", + "impressions" + ] + }, + "SponsoredLeagueDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "drivers": { + "type": "number" + }, + "races": { + "type": "number" + }, + "impressions": { + "type": "number" + } + }, + "required": [ + "id", + "name", + "enum", + "drivers", + "races", + "impressions" + ] + }, + "SponsorSponsorshipsDTO": { + "type": "object", + "properties": { + "sponsorships": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SponsorshipDetailDTO" + } + }, + "sponsorId": { + "type": "string" + }, + "sponsorName": { + "type": "string" + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[SponsorshipDetailDTO] })\n sponsorships: SponsorshipDetailDTO" + } + }, + "summary": { + "type": "string" + }, + "activeSponsorships": { + "type": "number" + }, + "totalInvestment": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "currency": { + "type": "string" + } + }, + "required": [ + "sponsorships", + "sponsorId", + "sponsorName", + "type", + "summary", + "activeSponsorships", + "totalInvestment", + "totalPlatformFees", + "currency" + ] + }, + "SponsorDashboardMetricsDTO": { + "type": "object", + "properties": { + "impressions": { + "type": "number" + }, + "impressionsChange": { + "type": "number" + }, + "uniqueViewers": { + "type": "number" + }, + "viewersChange": { + "type": "number" + }, + "races": { + "type": "number" + }, + "drivers": { + "type": "number" + }, + "exposure": { + "type": "number" + }, + "exposureChange": { + "type": "number" + } + }, + "required": [ + "impressions", + "impressionsChange", + "uniqueViewers", + "viewersChange", + "races", + "drivers", + "exposure", + "exposureChange" + ] + }, + "SponsorDashboardInvestmentDTO": { + "type": "object", + "properties": { + "activeSponsorships": { + "type": "number" + }, + "totalInvestment": { + "type": "number" + }, + "costPerThousandViews": { + "type": "number" + } + }, + "required": [ + "activeSponsorships", + "totalInvestment", + "costPerThousandViews" + ] + }, + "SponsorDashboardDTO": { + "type": "object", + "properties": { + "metrics": { + "$ref": "#/components/schemas/SponsorDashboardMetricsDTO" + }, + "sponsoredLeagues": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SponsoredLeagueDTO" + } + }, + "investment": { + "$ref": "#/components/schemas/SponsorDashboardInvestmentDTO" + }, + "sponsorId": { + "type": "string" + }, + "sponsorName": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/SponsorDashboardMetricsDTO })\n metrics: SponsorDashboardMetricsDTO" + } + }, + "required": [ + "metrics", + "sponsoredLeagues", + "investment", + "sponsorId", + "sponsorName", + "type" + ] + }, + "GetSponsorsOutputDTO": { + "type": "object", + "properties": { + "sponsors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SponsorDTO" + } + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[SponsorDTO] })\n sponsors: SponsorDTO" + } + } + }, + "required": [ + "sponsors", + "type" + ] + }, + "GetSponsorSponsorshipsQueryParamsDTO": { + "type": "object", + "properties": { + "sponsorId": { + "type": "string" + } + }, + "required": [ + "sponsorId" + ] + }, + "GetSponsorDashboardQueryParamsDTO": { + "type": "object", + "properties": { + "sponsorId": { + "type": "string" + } + }, + "required": [ + "sponsorId" + ] + }, + "GetEntitySponsorshipPricingResultDTO": { + "type": "object", + "properties": { + "pricing": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SponsorshipPricingItemDTO" + } + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[SponsorshipPricingItemDTO] })\n pricing: SponsorshipPricingItemDTO" + } + } + }, + "required": [ + "pricing", + "type" + ] + }, + "CreateSponsorOutputDTO": { + "type": "object", + "properties": { + "sponsor": { + "$ref": "#/components/schemas/SponsorDTO" + }, + "type": { + "$ref": "#/components/schemas/SponsorDTO })\n sponsor: SponsorDTO" + } + }, + "required": [ + "sponsor", + "type" + ] + }, + "CreateSponsorInputDTO": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "contactEmail": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "name", + "contactEmail", + "required" + ] + }, + "RacesPageDataRaceDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "RacesPageDataDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RacesPageDataRaceDto] })\n races!: RacesPageDataRaceDto" + } + } + }, + "required": [ + "type" + ] + }, + "RaceWithSOFDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "RaceResultsDetailDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RaceResultDto] })\n results!: RaceResultDto" + } + } + }, + "required": [ + "type" + ] + }, + "RaceProtestsDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RaceProtestDto] })\n protests!: RaceProtestDto" + } + } + }, + "required": [ + "type" + ] + }, + "RaceProtestDTO": { + "type": "object", + "properties": { + "lap": { + "type": "number" + }, + "description": { + "type": "string" + } + }, + "required": [ + "lap", + "description" + ] + }, + "RacePenaltyDTO": { + "type": "object", + "properties": { + "notes": { + "type": "string" + }, + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "RacePenaltiesDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RacePenaltyDTO] })\n penalties!: RacePenaltyDTO" + } + } + }, + "required": [ + "type" + ] + }, + "RaceDetailUserResultDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "RaceDetailRaceDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "nullable", + "required" + ] + }, + "RaceDetailLeagueDTO": { + "type": "object", + "properties": { + "maxDrivers": { + "type": "number" + }, + "qualifyingFormat": { + "type": "string" + } + }, + "required": [ + "maxDrivers", + "qualifyingFormat" + ] + }, + "RaceDetailEntryDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "RaceDetailDTO": { + "type": "object", + "properties": { + "nullable": { + "$ref": "#/components/schemas/true })\n race!: RaceDetailRaceDTO null" + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RaceDetailEntryDTO] })\n entryList!: RaceDetailEntryDTO" + } + }, + "required": { + "type": "string" + } + }, + "required": [ + "nullable", + "type", + "required" + ] + }, + "RaceDTO": { + "type": "object", + "properties": { + "leagueName": { + "type": "string" + }, + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "QuickPenaltyCommandDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + }, + "ImportRaceResultsSummaryDTO": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "type" + ] + }, + "FileProtestCommandDTO": { + "type": "object", + "properties": { + "lap": { + "type": "number" + }, + "description": { + "type": "string" + }, + "timeInRace": { + "type": "number" + }, + "required": { + "type": "string" + } + }, + "required": [ + "lap", + "description", + "timeInRace", + "required" + ] + }, + "DashboardRaceSummaryDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + } + }, + "required": [ + "enum" + ] + }, + "DashboardOverviewDTO": { + "type": "object", + "properties": { + "nullable": { + "$ref": "#/components/schemas/true })\n currentDriver!: DashboardDriverSummaryDTO null" + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[DashboardRaceSummaryDTO] })\n myUpcomingRaces!: DashboardRaceSummaryDTO" + } + } + }, + "required": [ + "nullable", + "type" + ] + }, + "DashboardFeedSummaryDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[DashboardFeedItemSummaryDTO] })\n items!: DashboardFeedItemSummaryDTO" + } + } + }, + "required": [ + "type" + ] + }, + "DashboardFeedItemSummaryDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + }, + "DashboardDriverSummaryDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "ApplyPenaltyCommandDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + }, + "AllRacesPageDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "type" + ] + }, + "UpdatePaymentStatusOutputDTO": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/PaymentDTO" + }, + "type": { + "$ref": "#/components/schemas/PaymentDTO })\n payment: PaymentDTO" + } + }, + "required": [ + "payment", + "type" + ] + }, + "UpdatePaymentStatusInputDTO": { + "type": "object", + "properties": { + "paymentId": { + "type": "string" + }, + "enum": { + "type": "string" + } + }, + "required": [ + "paymentId", + "enum" + ] + }, + "PaymentDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "MembershipFeeDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "MemberPaymentDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "PrizeDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "WalletDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "TransactionDto": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/MemberPaymentDto" + }, + "fee": { + "$ref": "#/components/schemas/MembershipFeeDto" + }, + "payments": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PaymentDto" + } + }, + "prizes": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PrizeDto" + } + }, + "prize": { + "$ref": "#/components/schemas/PrizeDto" + }, + "wallet": { + "$ref": "#/components/schemas/WalletDto" + }, + "transactions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransactionDto" + } + }, + "transaction": { + "$ref": "#/components/schemas/TransactionDto" + }, + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "type": { + "$ref": "#/components/schemas/PaymentDto })\n payment: PaymentDto" + }, + "paymentId": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "updatedAt": { + "type": "string", + "format": "date-time" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "dueDate": { + "type": "string", + "format": "date-time" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "awarded": { + "type": "boolean" + }, + "prizeId": { + "type": "string" + }, + "success": { + "type": "boolean" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "currency": { + "type": "string" + }, + "walletId": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "payment", + "payment", + "payments", + "fee", + "payment", + "payments", + "prizes", + "prize", + "prize", + "wallet", + "transactions", + "wallet", + "transaction", + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt", + "type", + "paymentId", + "enabled", + "updatedAt", + "feeId", + "driverId", + "dueDate", + "seasonId", + "position", + "name", + "awarded", + "prizeId", + "success", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "currency", + "walletId", + "description" + ] + }, + "PaymentDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "createdAt": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "id", + "enum", + "amount", + "platformFee", + "netAmount", + "payerId", + "leagueId", + "required", + "createdAt" + ] + }, + "CreatePaymentOutputDTO": { + "type": "object", + "properties": { + "payment": { + "$ref": "#/components/schemas/PaymentDTO" + }, + "type": { + "$ref": "#/components/schemas/PaymentDTO })\n payment: PaymentDTO" + } + }, + "required": [ + "payment", + "type" + ] + }, + "CreatePaymentInputDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "payerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "amount", + "payerId", + "leagueId", + "required" + ] + }, + "RequestAvatarGenerationOutputDTO": { + "type": "object", + "properties": { + "avatarUrls": { + "type": "array", + "items": { + "type": "string" + } + }, + "type": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "type", + "required" + ] + }, + "RequestAvatarGenerationInputDTO": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "facePhotoData": { + "type": "string" + }, + "suitColor": { + "type": "string" + } + }, + "required": [ + "userId", + "facePhotoData", + "suitColor" + ] + }, + "GetDriverRegistrationStatusQueryDTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + }, + "driverId": { + "type": "string" + } + }, + "required": [ + "raceId", + "driverId" + ] + }, + "DriversLeaderboardDTO": { + "type": "object", + "properties": { + "drivers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DriverLeaderboardItemDTO" + } + }, + "totalRaces": { + "type": "number" + }, + "totalWins": { + "type": "number" + }, + "activeCount": { + "type": "number" + }, + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[DriverLeaderboardItemDTO] })\n drivers: DriverLeaderboardItemDTO" + } + } + }, + "required": [ + "drivers", + "totalRaces", + "totalWins", + "activeCount", + "type" + ] + }, + "DriverStatsDTO": { + "type": "object", + "properties": { + "totalDrivers": { + "type": "number" + } + }, + "required": [ + "totalDrivers" + ] + }, + "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" + }, + "avatarUrl": { + "type": "string" + }, + "nullable": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "rating", + "skillLevel", + "nationality", + "racesCompleted", + "wins", + "podiums", + "isActive", + "rank", + "nullable" + ] + }, + "CompleteOnboardingOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "required": { + "type": "string" + } + }, + "required": [ + "success", + "required" + ] + }, + "CompleteOnboardingInputDTO": { + "type": "object", + "properties": { + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "country": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "firstName", + "lastName", + "displayName", + "country", + "required" + ] + }, + "UpdateLeagueMemberRoleOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ] + }, + "UpdateLeagueMemberRoleInputDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + }, + "performerDriverId": { + "type": "string" + }, + "targetDriverId": { + "type": "string" + }, + "enum": { + "type": "string" + } + }, + "required": [ + "leagueId", + "performerDriverId", + "targetDriverId", + "enum" + ] + }, + "SeasonDTO": { + "type": "object", + "properties": { + "seasonId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "required": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "isPrimary": { + "type": "boolean" + } + }, + "required": [ + "seasonId", + "name", + "leagueId", + "required", + "enum", + "isPrimary" + ] + }, + "RemoveLeagueMemberOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ] + }, + "RemoveLeagueMemberInputDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + }, + "performerDriverId": { + "type": "string" + }, + "targetDriverId": { + "type": "string" + } + }, + "required": [ + "leagueId", + "performerDriverId", + "targetDriverId" + ] + }, + "RejectJoinRequestOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "required": { + "type": "string" + } + }, + "required": [ + "success", + "required" + ] + }, + "RejectJoinRequestInputDTO": { + "type": "object", + "properties": { + "requestId": { + "type": "string" + }, + "leagueId": { + "type": "string" + } + }, + "required": [ + "requestId", + "leagueId" + ] + }, + "ProtestDTO": { + "type": "object", + "properties": { + "TODO": { + "$ref": "#/components/schemas/protests are filed at race level but also managed on league level\n\nexport class ProtestDTO {\n @ApiProperty()\n @IsString()\n id: string" + }, + "raceId": { + "type": "string" + }, + "protestingDriverId": { + "type": "string" + }, + "accusedDriverId": { + "type": "string" + }, + "submittedAt": { + "type": "string", + "format": "date-time" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "string" + } + }, + "required": [ + "TODO", + "raceId", + "protestingDriverId", + "accusedDriverId", + "submittedAt", + "description", + "enum" + ] + }, + "LeagueWithCapacityDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "nullable": { + "type": "string" + }, + "ownerId": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/() => LeagueSettingsDTO })\n @ValidateNested()\n @Type(() => LeagueSettingsDTO)\n settings: LeagueSettingsDTO" + }, + "createdAt": { + "type": "string" + }, + "usedSlots": { + "type": "number" + }, + "youtubeUrl": { + "type": "string" + }, + "websiteUrl": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "nullable", + "ownerId", + "type", + "createdAt", + "usedSlots", + "youtubeUrl", + "websiteUrl" + ] + }, + "LeagueSummaryDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "nullable": { + "type": "string" + }, + "memberCount": { + "type": "number" + }, + "maxMembers": { + "type": "number" + }, + "isPublic": { + "type": "boolean" + }, + "ownerId": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "nullable", + "memberCount", + "maxMembers", + "isPublic", + "ownerId" + ] + }, + "LeagueStatsDTO": { + "type": "object", + "properties": { + "totalMembers": { + "type": "number" + }, + "totalRaces": { + "type": "number" + }, + "averageRating": { + "type": "number" + } + }, + "required": [ + "totalMembers", + "totalRaces", + "averageRating" + ] + }, + "LeagueStandingsDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[LeagueStandingDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueStandingDTO)\n standings: LeagueStandingDTO" + } + } + }, + "required": [ + "type" + ] + }, + "LeagueStandingDTO": { + "type": "object", + "properties": { + "driverId": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/() => DriverDto })\n @ValidateNested()\n @Type(() => DriverDto)\n driver: DriverDto" + }, + "points": { + "type": "number" + }, + "rank": { + "type": "number" + } + }, + "required": [ + "driverId", + "type", + "points", + "rank" + ] + }, + "LeagueSettingsDTO": { + "type": "object", + "properties": { + "nullable": { + "type": "string" + } + }, + "required": [ + "nullable" + ] + }, + "LeagueSeasonSummaryDTO": { + "type": "object", + "properties": { + "seasonId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": "string" + }, + "required": { + "type": "string" + }, + "isPrimary": { + "type": "boolean" + }, + "isParallelActive": { + "type": "boolean" + } + }, + "required": [ + "seasonId", + "name", + "status", + "required", + "isPrimary", + "isParallelActive" + ] + }, + "LeagueScheduleDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[RaceDto] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => RaceDto)\n races: RaceDto" + } + } + }, + "required": [ + "type" + ] + }, + "LeagueOwnerSummaryDTO": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/() => DriverDto })\n @ValidateNested()\n @Type(() => DriverDto)\n driver: DriverDto" + }, + "nullable": { + "type": "string" + } + }, + "required": [ + "type", + "nullable" + ] + }, + "LeagueMembershipsDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[LeagueMemberDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueMemberDTO)\n members: LeagueMemberDTO" + } + } + }, + "required": [ + "type" + ] + }, + "LeagueMemberDTO": { + "type": "object", + "properties": { + "driverId": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/() => DriverDto })\n @ValidateNested()\n @Type(() => DriverDto)\n driver: DriverDto" + }, + "enum": { + "type": "string" + }, + "joinedAt": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "driverId", + "type", + "enum", + "joinedAt" + ] + }, + "LeagueJoinRequestDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "requestedAt": { + "type": "string", + "format": "date-time" + }, + "required": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/() => DriverDto, required: false })\n @IsOptional()\n @ValidateNested()\n @Type(() => DriverDto)\n driver?: DriverDto" + } + }, + "required": [ + "id", + "leagueId", + "driverId", + "requestedAt", + "required", + "type" + ] + }, + "LeagueConfigFormModelTimingsDTO": { + "type": "object", + "properties": { + "raceDayOfWeek": { + "type": "string" + }, + "raceTimeHour": { + "type": "number" + }, + "raceTimeMinute": { + "type": "number" + } + }, + "required": [ + "raceDayOfWeek", + "raceTimeHour", + "raceTimeMinute" + ] + }, + "LeagueConfigFormModelStructureDTO": { + "type": "object", + "properties": { + "mode": { + "type": "string" + } + }, + "required": [ + "mode" + ] + }, + "LeagueConfigFormModelStewardingDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + }, + "requireDefense": { + "type": "boolean" + }, + "defenseTimeLimit": { + "type": "number" + }, + "voteTimeLimit": { + "type": "number" + }, + "protestDeadlineHours": { + "type": "number" + }, + "stewardingClosesHours": { + "type": "number" + }, + "notifyAccusedOnProtest": { + "type": "boolean" + }, + "notifyOnVoteRequired": { + "type": "boolean" + } + }, + "required": [ + "enum", + "required", + "requireDefense", + "defenseTimeLimit", + "voteTimeLimit", + "protestDeadlineHours", + "stewardingClosesHours", + "notifyAccusedOnProtest", + "notifyOnVoteRequired" + ] + }, + "LeagueConfigFormModelScoringDTO": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "points": { + "type": "number" + } + }, + "required": [ + "type", + "points" + ] + }, + "LeagueConfigFormModelDropPolicyDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + }, + "LeagueConfigFormModelDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + }, + "type": { + "$ref": "#/components/schemas/LeagueConfigFormModelBasicsDTO })\n @ValidateNested()\n @Type(() => LeagueConfigFormModelBasicsDTO)\n basics: LeagueConfigFormModelBasicsDTO" + } + }, + "required": [ + "leagueId", + "type" + ] + }, + "LeagueConfigFormModelBasicsDTO": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "enum" + ] + }, + "LeagueAdminProtestsDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[ProtestDTO] }) \n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => ProtestDTO)\n protests: ProtestDTO" + } + } + }, + "required": [ + "type" + ] + }, + "LeagueAdminPermissionsDTO": { + "type": "object", + "properties": { + "canRemoveMember": { + "type": "boolean" + }, + "canUpdateRoles": { + "type": "boolean" + } + }, + "required": [ + "canRemoveMember", + "canUpdateRoles" + ] + }, + "LeagueAdminDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[LeagueJoinRequestDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueJoinRequestDTO)\n joinRequests: LeagueJoinRequestDTO" + } + } + }, + "required": [ + "type" + ] + }, + "LeagueAdminConfigDTO": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/() => LeagueConfigFormModelDTO, nullable: true })\n @IsOptional()\n @ValidateNested()\n @Type(() => LeagueConfigFormModelDTO)\n form: LeagueConfigFormModelDTO null" + } + }, + "required": [ + "type" + ] + }, + "GetLeagueSeasonsQueryDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + } + }, + "required": [ + "leagueId" + ] + }, + "GetLeagueProtestsQueryDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + } + }, + "required": [ + "leagueId" + ] + }, + "GetLeagueOwnerSummaryQueryDTO": { + "type": "object", + "properties": { + "ownerId": { + "type": "string" + }, + "leagueId": { + "type": "string" + } + }, + "required": [ + "ownerId", + "leagueId" + ] + }, + "GetLeagueJoinRequestsQueryDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + } + }, + "required": [ + "leagueId" + ] + }, + "GetLeagueAdminPermissionsInputDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + }, + "performerDriverId": { + "type": "string" + } + }, + "required": [ + "leagueId", + "performerDriverId" + ] + }, + "GetLeagueAdminConfigQueryDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + } + }, + "required": [ + "leagueId" + ] + }, + "GetLeagueAdminConfigOutputDTO": { + "type": "object", + "properties": { + "type": { + "$ref": "#/components/schemas/() => LeagueConfigFormModelDTO, nullable: true })\n @IsOptional()\n @ValidateNested()\n @Type(() => LeagueConfigFormModelDTO)\n form: LeagueConfigFormModelDTO null" + } + }, + "required": [ + "type" + ] + }, + "CreateLeagueOutputDTO": { + "type": "object", + "properties": { + "leagueId": { + "type": "string" + }, + "success": { + "type": "boolean" + } + }, + "required": [ + "leagueId", + "success" + ] + }, + "CreateLeagueInputDTO": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "enum": { + "type": "string" + }, + "ownerId": { + "type": "string" + } + }, + "required": [ + "name", + "description", + "enum", + "ownerId" + ] + }, + "ApproveJoinRequestOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + }, + "required": { + "type": "string" + } + }, + "required": [ + "success", + "required" + ] + }, + "ApproveJoinRequestInputDTO": { + "type": "object", + "properties": { + "requestId": { + "type": "string" + }, + "leagueId": { + "type": "string" + } + }, + "required": [ + "requestId", + "leagueId" + ] + }, + "AllLeaguesWithCapacityDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[LeagueWithCapacityDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueWithCapacityDTO)\n leagues: LeagueWithCapacityDTO" + } + }, + "totalCount": { + "type": "number" + } + }, + "required": [ + "type", + "totalCount" + ] + }, + "AllLeaguesWithCapacityAndScoringDTO": { + "type": "object", + "properties": { + "type": { + "type": "array", + "items": { + "$ref": "#/components/schemas/[LeagueSummaryDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueSummaryDTO)\n leagues: LeagueSummaryDTO" + } + }, + "totalCount": { + "type": "number" + } + }, + "required": [ + "type", + "totalCount" + ] + }, + "AuthenticatedUserDTO": { + "type": "object", + "properties": { + "iracingCustomerId": { + "type": "string" + }, + "primaryDriverId": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "returnTo": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "required" + ] + }, + "AuthSessionDTO": { + "type": "object", + "properties": { + "iracingCustomerId": { + "type": "string" + }, + "primaryDriverId": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "returnTo": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "required" + ] + }, + "RecordPageViewInputDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + }, + "RecordEngagementInputDTO": { + "type": "object", + "properties": { + "enum": { + "type": "string" + }, + "required": { + "type": "string" + } + }, + "required": [ + "enum", + "required" + ] + } + } + } +} \ No newline at end of file diff --git a/apps/api/package.json b/apps/api/package.json index 4994eb52b..6c0757ab3 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -8,7 +8,8 @@ "start:dev": "ts-node-dev --respawn --inspect=0.0.0.0:9229 src/main.ts", "start:prod": "node dist/main", "test": "vitest run", - "test:watch": "vitest" + "test:watch": "vitest", + "generate:openapi": "GENERATE_OPENAPI=true ts-node src/main.ts --exit" }, "keywords": [], "author": "", diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index e868708c4..737d9f0ea 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -2,10 +2,41 @@ import 'reflect-metadata'; // For NestJS DI (before any other imports) import { NestFactory } from '@nestjs/core'; +import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; +import { writeFileSync } from 'fs'; +import { join } from 'path'; import { AppModule } from './app.module'; async function bootstrap() { const app = await NestFactory.create(AppModule); + + // Swagger/OpenAPI configuration + const config = new DocumentBuilder() + .setTitle('GridPilot API') + .setDescription('GridPilot API documentation') + .setVersion('1.0') + .addTag('races', 'Race management endpoints') + .addTag('leagues', 'League management endpoints') + .addTag('teams', 'Team management endpoints') + .addTag('drivers', 'Driver management endpoints') + .addTag('sponsors', 'Sponsor management endpoints') + .addTag('payments', 'Payment and billing endpoints') + .addTag('media', 'Media and file management endpoints') + .addTag('analytics', 'Analytics and reporting endpoints') + .build(); + + const document = SwaggerModule.createDocument(app, config); + + // Serve Swagger UI at /api/docs + SwaggerModule.setup('api/docs', app, document); + + // Export OpenAPI spec as JSON file when GENERATE_OPENAPI env var is set + if (process.env.GENERATE_OPENAPI) { + const outputPath = join(__dirname, '../openapi.json'); + writeFileSync(outputPath, JSON.stringify(document, null, 2)); + console.log(`✅ OpenAPI spec generated at: ${outputPath}`); + } + await app.listen(3000); } bootstrap(); diff --git a/apps/website/lib/api/drivers/DriversApiClient.ts b/apps/website/lib/api/drivers/DriversApiClient.ts index 44b5575a3..86c47470f 100644 --- a/apps/website/lib/api/drivers/DriversApiClient.ts +++ b/apps/website/lib/api/drivers/DriversApiClient.ts @@ -1,11 +1,10 @@ import { BaseApiClient } from '../base/BaseApiClient'; import type { DriversLeaderboardDto, - CompleteOnboardingInputDto, - CompleteOnboardingOutputDto, - DriverDto, DriverRegistrationStatusDto, } from '../../dtos'; +// Import generated types +import type { DriverDTO, CompleteOnboardingInputDTO, CompleteOnboardingOutputDTO } from '../../types/api-helpers'; /** * Drivers API Client @@ -19,12 +18,12 @@ export class DriversApiClient extends BaseApiClient { } /** Complete driver onboarding */ - completeOnboarding(input: CompleteOnboardingInputDto): Promise { + completeOnboarding(input: CompleteOnboardingInputDTO): Promise { return this.post('/drivers/complete-onboarding', input); } /** Get current driver (based on session) */ - getCurrent(): Promise { + getCurrent(): Promise { return this.get('/drivers/current'); } diff --git a/apps/website/lib/services/drivers/DriverService.ts b/apps/website/lib/services/drivers/DriverService.ts index 50941ec78..3e92cae76 100644 --- a/apps/website/lib/services/drivers/DriverService.ts +++ b/apps/website/lib/services/drivers/DriverService.ts @@ -5,7 +5,8 @@ import type { CompleteOnboardingPresenter } from '../../presenters/CompleteOnboa import type { DriverLeaderboardViewModel } from '../../view-models'; import type { DriverViewModel } from '../../view-models/DriverViewModel'; import type { CompleteOnboardingViewModel } from '../../view-models/CompleteOnboardingViewModel'; -import type { CompleteOnboardingInputDto } from '../../dtos'; +// Import generated types instead of manual DTOs +import type { CompleteOnboardingInputDTO } from '../../types/api-helpers'; /** * Driver Service @@ -32,7 +33,7 @@ export class DriverService { /** * Complete driver onboarding with presentation transformation */ - async completeDriverOnboarding(input: CompleteOnboardingInputDto): Promise { + async completeDriverOnboarding(input: CompleteOnboardingInputDTO): Promise { const dto = await this.apiClient.completeOnboarding(input); return this.onboardingPresenter.present(dto); } diff --git a/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts b/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts new file mode 100644 index 000000000..da11c6ffd --- /dev/null +++ b/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface AllLeaguesWithCapacityAndScoringDTO { + type: [LeagueSummaryDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => LeagueSummaryDTO) + leagues: LeagueSummaryDTO[]; + totalCount: number; +} diff --git a/apps/website/lib/types/generated/AllLeaguesWithCapacityDTO.ts b/apps/website/lib/types/generated/AllLeaguesWithCapacityDTO.ts new file mode 100644 index 000000000..6b8ce3b5e --- /dev/null +++ b/apps/website/lib/types/generated/AllLeaguesWithCapacityDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface AllLeaguesWithCapacityDTO { + type: [LeagueWithCapacityDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => LeagueWithCapacityDTO) + leagues: LeagueWithCapacityDTO[]; + totalCount: number; +} diff --git a/apps/website/lib/types/generated/AllRacesPageDTO.ts b/apps/website/lib/types/generated/AllRacesPageDTO.ts new file mode 100644 index 000000000..d05441188 --- /dev/null +++ b/apps/website/lib/types/generated/AllRacesPageDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface AllRacesPageDTO { + type: string[]; +} diff --git a/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts b/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts new file mode 100644 index 000000000..38bc19775 --- /dev/null +++ b/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ApplyPenaltyCommandDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/ApproveJoinRequestInputDTO.ts b/apps/website/lib/types/generated/ApproveJoinRequestInputDTO.ts new file mode 100644 index 000000000..af223f594 --- /dev/null +++ b/apps/website/lib/types/generated/ApproveJoinRequestInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ApproveJoinRequestInputDTO { + requestId: string; + leagueId: string; +} diff --git a/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts b/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts new file mode 100644 index 000000000..229b7b9bb --- /dev/null +++ b/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ApproveJoinRequestOutputDTO { + success: boolean; + required: string; +} diff --git a/apps/website/lib/types/generated/AuthSessionDTO.ts b/apps/website/lib/types/generated/AuthSessionDTO.ts new file mode 100644 index 000000000..3e9cb6b61 --- /dev/null +++ b/apps/website/lib/types/generated/AuthSessionDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface AuthSessionDTO { + iracingCustomerId?: string; + primaryDriverId?: string; + avatarUrl?: string; + returnTo?: string; + required: string; +} diff --git a/apps/website/lib/types/generated/AuthenticatedUserDTO.ts b/apps/website/lib/types/generated/AuthenticatedUserDTO.ts new file mode 100644 index 000000000..20303e860 --- /dev/null +++ b/apps/website/lib/types/generated/AuthenticatedUserDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface AuthenticatedUserDTO { + iracingCustomerId?: string; + primaryDriverId?: string; + avatarUrl?: string; + returnTo?: string; + required: string; +} diff --git a/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts b/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts new file mode 100644 index 000000000..a07df2da9 --- /dev/null +++ b/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CompleteOnboardingInputDTO { + firstName: string; + lastName: string; + displayName: string; + country: string; + required: string; +} diff --git a/apps/website/lib/types/generated/CompleteOnboardingOutputDTO.ts b/apps/website/lib/types/generated/CompleteOnboardingOutputDTO.ts new file mode 100644 index 000000000..30e88827d --- /dev/null +++ b/apps/website/lib/types/generated/CompleteOnboardingOutputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CompleteOnboardingOutputDTO { + success: boolean; + required: string; +} diff --git a/apps/website/lib/types/generated/CreateDriverOutputDto.ts b/apps/website/lib/types/generated/CreateDriverOutputDto.ts new file mode 100644 index 000000000..3a938b3be --- /dev/null +++ b/apps/website/lib/types/generated/CreateDriverOutputDto.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreateDriverOutputDto { + success?: boolean; + driverId?: string; +} diff --git a/apps/website/lib/types/generated/CreateLeagueInputDTO.ts b/apps/website/lib/types/generated/CreateLeagueInputDTO.ts new file mode 100644 index 000000000..cd7d26ea5 --- /dev/null +++ b/apps/website/lib/types/generated/CreateLeagueInputDTO.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreateLeagueInputDTO { + name: string; + description: string; + enum: string; + ownerId: string; +} diff --git a/apps/website/lib/types/generated/CreateLeagueOutputDTO.ts b/apps/website/lib/types/generated/CreateLeagueOutputDTO.ts new file mode 100644 index 000000000..281f96b9a --- /dev/null +++ b/apps/website/lib/types/generated/CreateLeagueOutputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreateLeagueOutputDTO { + leagueId: string; + success: boolean; +} diff --git a/apps/website/lib/types/generated/CreatePaymentInputDTO.ts b/apps/website/lib/types/generated/CreatePaymentInputDTO.ts new file mode 100644 index 000000000..e0019fc98 --- /dev/null +++ b/apps/website/lib/types/generated/CreatePaymentInputDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreatePaymentInputDTO { + enum: string; + amount: number; + payerId: string; + leagueId: string; + required: string; +} diff --git a/apps/website/lib/types/generated/CreatePaymentOutputDTO.ts b/apps/website/lib/types/generated/CreatePaymentOutputDTO.ts new file mode 100644 index 000000000..a036326b4 --- /dev/null +++ b/apps/website/lib/types/generated/CreatePaymentOutputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreatePaymentOutputDTO { + payment: PaymentDTO; + type: PaymentDTO }) + payment: PaymentDTO; +} diff --git a/apps/website/lib/types/generated/CreateSponsorInputDTO.ts b/apps/website/lib/types/generated/CreateSponsorInputDTO.ts new file mode 100644 index 000000000..46eac70b4 --- /dev/null +++ b/apps/website/lib/types/generated/CreateSponsorInputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreateSponsorInputDTO { + name: string; + contactEmail: string; + required: string; +} diff --git a/apps/website/lib/types/generated/CreateSponsorOutputDTO.ts b/apps/website/lib/types/generated/CreateSponsorOutputDTO.ts new file mode 100644 index 000000000..00156a7f5 --- /dev/null +++ b/apps/website/lib/types/generated/CreateSponsorOutputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface CreateSponsorOutputDTO { + sponsor: SponsorDTO; + type: SponsorDTO }) + sponsor: SponsorDTO; +} diff --git a/apps/website/lib/types/generated/DashboardDriverSummaryDTO.ts b/apps/website/lib/types/generated/DashboardDriverSummaryDTO.ts new file mode 100644 index 000000000..65305f18b --- /dev/null +++ b/apps/website/lib/types/generated/DashboardDriverSummaryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DashboardDriverSummaryDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts b/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts new file mode 100644 index 000000000..4c4b24c39 --- /dev/null +++ b/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DashboardFeedItemSummaryDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts b/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts new file mode 100644 index 000000000..dc42b33f7 --- /dev/null +++ b/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DashboardFeedSummaryDTO { + type: [DashboardFeedItemSummaryDTO] }) + items!: DashboardFeedItemSummaryDTO[]; +} diff --git a/apps/website/lib/types/generated/DashboardOverviewDTO.ts b/apps/website/lib/types/generated/DashboardOverviewDTO.ts new file mode 100644 index 000000000..19cdc01f5 --- /dev/null +++ b/apps/website/lib/types/generated/DashboardOverviewDTO.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DashboardOverviewDTO { + nullable: true }) + currentDriver!: DashboardDriverSummaryDTO null; + type: [DashboardRaceSummaryDTO] }) + myUpcomingRaces!: DashboardRaceSummaryDTO[]; +} diff --git a/apps/website/lib/types/generated/DashboardRaceSummaryDTO.ts b/apps/website/lib/types/generated/DashboardRaceSummaryDTO.ts new file mode 100644 index 000000000..35479b8b9 --- /dev/null +++ b/apps/website/lib/types/generated/DashboardRaceSummaryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DashboardRaceSummaryDTO { + enum: string; +} diff --git a/apps/website/lib/types/generated/DriverDto.ts b/apps/website/lib/types/generated/DriverDto.ts new file mode 100644 index 000000000..94db748ae --- /dev/null +++ b/apps/website/lib/types/generated/DriverDto.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DriverDto { + id: string; + name: string; + avatarUrl?: string; + iracingId?: string; + rating?: number; +} diff --git a/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts b/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts new file mode 100644 index 000000000..a6fbadbe8 --- /dev/null +++ b/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts @@ -0,0 +1,20 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DriverLeaderboardItemDTO { + id: string; + name: string; + rating: number; + skillLevel: string; + nationality: string; + racesCompleted: number; + wins: number; + podiums: number; + isActive: boolean; + rank: number; + avatarUrl?: string; + nullable: string; +} diff --git a/apps/website/lib/types/generated/DriverStatsDTO.ts b/apps/website/lib/types/generated/DriverStatsDTO.ts new file mode 100644 index 000000000..11dbc2289 --- /dev/null +++ b/apps/website/lib/types/generated/DriverStatsDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DriverStatsDTO { + totalDrivers: number; +} diff --git a/apps/website/lib/types/generated/DriversLeaderboardDTO.ts b/apps/website/lib/types/generated/DriversLeaderboardDTO.ts new file mode 100644 index 000000000..2291c93a8 --- /dev/null +++ b/apps/website/lib/types/generated/DriversLeaderboardDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface DriversLeaderboardDTO { + drivers: DriverLeaderboardItemDTO[]; + totalRaces: number; + totalWins: number; + activeCount: number; + type: [DriverLeaderboardItemDTO] }) + drivers: DriverLeaderboardItemDTO[]; +} diff --git a/apps/website/lib/types/generated/FileProtestCommandDTO.ts b/apps/website/lib/types/generated/FileProtestCommandDTO.ts new file mode 100644 index 000000000..602269ba8 --- /dev/null +++ b/apps/website/lib/types/generated/FileProtestCommandDTO.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface FileProtestCommandDTO { + lap: number; + description: string; + timeInRace: number; + required: string; +} diff --git a/apps/website/lib/types/generated/GetDriverRegistrationStatusQueryDTO.ts b/apps/website/lib/types/generated/GetDriverRegistrationStatusQueryDTO.ts new file mode 100644 index 000000000..db72388b0 --- /dev/null +++ b/apps/website/lib/types/generated/GetDriverRegistrationStatusQueryDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetDriverRegistrationStatusQueryDTO { + raceId: string; + driverId: string; +} diff --git a/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts b/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts new file mode 100644 index 000000000..4920613c3 --- /dev/null +++ b/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetEntitySponsorshipPricingResultDTO { + pricing: SponsorshipPricingItemDTO[]; + type: [SponsorshipPricingItemDTO] }) + pricing: SponsorshipPricingItemDTO[]; +} diff --git a/apps/website/lib/types/generated/GetLeagueAdminConfigOutputDTO.ts b/apps/website/lib/types/generated/GetLeagueAdminConfigOutputDTO.ts new file mode 100644 index 000000000..35a2e26ff --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueAdminConfigOutputDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueAdminConfigOutputDTO { + type: () => LeagueConfigFormModelDTO, nullable: true }) + @IsOptional() + @ValidateNested() + @Type(() => LeagueConfigFormModelDTO) + form: LeagueConfigFormModelDTO null; +} diff --git a/apps/website/lib/types/generated/GetLeagueAdminConfigQueryDTO.ts b/apps/website/lib/types/generated/GetLeagueAdminConfigQueryDTO.ts new file mode 100644 index 000000000..07273df1e --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueAdminConfigQueryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueAdminConfigQueryDTO { + leagueId: string; +} diff --git a/apps/website/lib/types/generated/GetLeagueAdminPermissionsInputDTO.ts b/apps/website/lib/types/generated/GetLeagueAdminPermissionsInputDTO.ts new file mode 100644 index 000000000..b5755ab71 --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueAdminPermissionsInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueAdminPermissionsInputDTO { + leagueId: string; + performerDriverId: string; +} diff --git a/apps/website/lib/types/generated/GetLeagueJoinRequestsQueryDTO.ts b/apps/website/lib/types/generated/GetLeagueJoinRequestsQueryDTO.ts new file mode 100644 index 000000000..ed02a597b --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueJoinRequestsQueryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueJoinRequestsQueryDTO { + leagueId: string; +} diff --git a/apps/website/lib/types/generated/GetLeagueOwnerSummaryQueryDTO.ts b/apps/website/lib/types/generated/GetLeagueOwnerSummaryQueryDTO.ts new file mode 100644 index 000000000..f1d826ee7 --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueOwnerSummaryQueryDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueOwnerSummaryQueryDTO { + ownerId: string; + leagueId: string; +} diff --git a/apps/website/lib/types/generated/GetLeagueProtestsQueryDTO.ts b/apps/website/lib/types/generated/GetLeagueProtestsQueryDTO.ts new file mode 100644 index 000000000..0b833dfe5 --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueProtestsQueryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueProtestsQueryDTO { + leagueId: string; +} diff --git a/apps/website/lib/types/generated/GetLeagueSeasonsQueryDTO.ts b/apps/website/lib/types/generated/GetLeagueSeasonsQueryDTO.ts new file mode 100644 index 000000000..5203f4460 --- /dev/null +++ b/apps/website/lib/types/generated/GetLeagueSeasonsQueryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetLeagueSeasonsQueryDTO { + leagueId: string; +} diff --git a/apps/website/lib/types/generated/GetSponsorDashboardQueryParamsDTO.ts b/apps/website/lib/types/generated/GetSponsorDashboardQueryParamsDTO.ts new file mode 100644 index 000000000..99a8fb021 --- /dev/null +++ b/apps/website/lib/types/generated/GetSponsorDashboardQueryParamsDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetSponsorDashboardQueryParamsDTO { + sponsorId: string; +} diff --git a/apps/website/lib/types/generated/GetSponsorSponsorshipsQueryParamsDTO.ts b/apps/website/lib/types/generated/GetSponsorSponsorshipsQueryParamsDTO.ts new file mode 100644 index 000000000..ef07d69c0 --- /dev/null +++ b/apps/website/lib/types/generated/GetSponsorSponsorshipsQueryParamsDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetSponsorSponsorshipsQueryParamsDTO { + sponsorId: string; +} diff --git a/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts b/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts new file mode 100644 index 000000000..f46f5597b --- /dev/null +++ b/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface GetSponsorsOutputDTO { + sponsors: SponsorDTO[]; + type: [SponsorDTO] }) + sponsors: SponsorDTO[]; +} diff --git a/apps/website/lib/types/generated/ImportRaceResultsSummaryDTO.ts b/apps/website/lib/types/generated/ImportRaceResultsSummaryDTO.ts new file mode 100644 index 000000000..6d467e636 --- /dev/null +++ b/apps/website/lib/types/generated/ImportRaceResultsSummaryDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ImportRaceResultsSummaryDTO { + errors?: string[]; + type: string[]; +} diff --git a/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts b/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts new file mode 100644 index 000000000..5b2922029 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueAdminConfigDTO { + type: () => LeagueConfigFormModelDTO, nullable: true }) + @IsOptional() + @ValidateNested() + @Type(() => LeagueConfigFormModelDTO) + form: LeagueConfigFormModelDTO null; +} diff --git a/apps/website/lib/types/generated/LeagueAdminDTO.ts b/apps/website/lib/types/generated/LeagueAdminDTO.ts new file mode 100644 index 000000000..a14d4e1aa --- /dev/null +++ b/apps/website/lib/types/generated/LeagueAdminDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueAdminDTO { + type: [LeagueJoinRequestDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => LeagueJoinRequestDTO) + joinRequests: LeagueJoinRequestDTO[]; +} diff --git a/apps/website/lib/types/generated/LeagueAdminPermissionsDTO.ts b/apps/website/lib/types/generated/LeagueAdminPermissionsDTO.ts new file mode 100644 index 000000000..223622bc1 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueAdminPermissionsDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueAdminPermissionsDTO { + canRemoveMember: boolean; + canUpdateRoles: boolean; +} diff --git a/apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts b/apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts new file mode 100644 index 000000000..4bc3fb25c --- /dev/null +++ b/apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueAdminProtestsDTO { + type: [ProtestDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => ProtestDTO) + protests: ProtestDTO[]; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelBasicsDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelBasicsDTO.ts new file mode 100644 index 000000000..773e97cdb --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelBasicsDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelBasicsDTO { + name: string; + description: string; + enum: string; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelDTO.ts new file mode 100644 index 000000000..0ffc06eef --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelDTO { + leagueId: string; + type: LeagueConfigFormModelBasicsDTO }) + @ValidateNested() + @Type(() => LeagueConfigFormModelBasicsDTO) + basics: LeagueConfigFormModelBasicsDTO; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts new file mode 100644 index 000000000..bcfd7fe08 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelDropPolicyDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelScoringDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelScoringDTO.ts new file mode 100644 index 000000000..59c4a71ca --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelScoringDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelScoringDTO { + type: string; + points: number; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts new file mode 100644 index 000000000..0cb46880f --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts @@ -0,0 +1,17 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelStewardingDTO { + enum: string; + required: string; + requireDefense: boolean; + defenseTimeLimit: number; + voteTimeLimit: number; + protestDeadlineHours: number; + stewardingClosesHours: number; + notifyAccusedOnProtest: boolean; + notifyOnVoteRequired: boolean; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelStructureDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelStructureDTO.ts new file mode 100644 index 000000000..859fc701d --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelStructureDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelStructureDTO { + mode: string; +} diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelTimingsDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelTimingsDTO.ts new file mode 100644 index 000000000..d82096674 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueConfigFormModelTimingsDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueConfigFormModelTimingsDTO { + raceDayOfWeek: string; + raceTimeHour: number; + raceTimeMinute: number; +} diff --git a/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts b/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts new file mode 100644 index 000000000..2626a8bc3 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts @@ -0,0 +1,18 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueJoinRequestDTO { + id: string; + leagueId: string; + driverId: string; + requestedAt: string; + required: string; + type: () => DriverDto, required: false }) + @IsOptional() + @ValidateNested() + @Type(() => DriverDto) + driver?: DriverDto; +} diff --git a/apps/website/lib/types/generated/LeagueMemberDTO.ts b/apps/website/lib/types/generated/LeagueMemberDTO.ts new file mode 100644 index 000000000..0f6c89ff0 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueMemberDTO.ts @@ -0,0 +1,15 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueMemberDTO { + driverId: string; + type: () => DriverDto }) + @ValidateNested() + @Type(() => DriverDto) + driver: DriverDto; + enum: string; + joinedAt: string; +} diff --git a/apps/website/lib/types/generated/LeagueMembershipsDTO.ts b/apps/website/lib/types/generated/LeagueMembershipsDTO.ts new file mode 100644 index 000000000..27d39dbe3 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueMembershipsDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueMembershipsDTO { + type: [LeagueMemberDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => LeagueMemberDTO) + members: LeagueMemberDTO[]; +} diff --git a/apps/website/lib/types/generated/LeagueOwnerSummaryDTO.ts b/apps/website/lib/types/generated/LeagueOwnerSummaryDTO.ts new file mode 100644 index 000000000..be1840e52 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueOwnerSummaryDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueOwnerSummaryDTO { + type: () => DriverDto }) + @ValidateNested() + @Type(() => DriverDto) + driver: DriverDto; + nullable: string; +} diff --git a/apps/website/lib/types/generated/LeagueScheduleDTO.ts b/apps/website/lib/types/generated/LeagueScheduleDTO.ts new file mode 100644 index 000000000..d0302cedf --- /dev/null +++ b/apps/website/lib/types/generated/LeagueScheduleDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueScheduleDTO { + type: [RaceDto] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => RaceDto) + races: RaceDto[]; +} diff --git a/apps/website/lib/types/generated/LeagueSeasonSummaryDTO.ts b/apps/website/lib/types/generated/LeagueSeasonSummaryDTO.ts new file mode 100644 index 000000000..e66278ab0 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueSeasonSummaryDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueSeasonSummaryDTO { + seasonId: string; + name: string; + status: string; + required: string; + isPrimary: boolean; + isParallelActive: boolean; +} diff --git a/apps/website/lib/types/generated/LeagueSettingsDTO.ts b/apps/website/lib/types/generated/LeagueSettingsDTO.ts new file mode 100644 index 000000000..416e02251 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueSettingsDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueSettingsDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/LeagueStandingDTO.ts b/apps/website/lib/types/generated/LeagueStandingDTO.ts new file mode 100644 index 000000000..7743c1c73 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueStandingDTO.ts @@ -0,0 +1,15 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueStandingDTO { + driverId: string; + type: () => DriverDto }) + @ValidateNested() + @Type(() => DriverDto) + driver: DriverDto; + points: number; + rank: number; +} diff --git a/apps/website/lib/types/generated/LeagueStandingsDTO.ts b/apps/website/lib/types/generated/LeagueStandingsDTO.ts new file mode 100644 index 000000000..acf719451 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueStandingsDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueStandingsDTO { + type: [LeagueStandingDTO] }) + @IsArray() + @ValidateNested({ each: true }) + @Type(() => LeagueStandingDTO) + standings: LeagueStandingDTO[]; +} diff --git a/apps/website/lib/types/generated/LeagueStatsDTO.ts b/apps/website/lib/types/generated/LeagueStatsDTO.ts new file mode 100644 index 000000000..9edfa7b19 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueStatsDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueStatsDTO { + totalMembers: number; + totalRaces: number; + averageRating: number; +} diff --git a/apps/website/lib/types/generated/LeagueSummaryDTO.ts b/apps/website/lib/types/generated/LeagueSummaryDTO.ts new file mode 100644 index 000000000..6abc38d22 --- /dev/null +++ b/apps/website/lib/types/generated/LeagueSummaryDTO.ts @@ -0,0 +1,15 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueSummaryDTO { + id: string; + name: string; + nullable: string; + memberCount: number; + maxMembers: number; + isPublic: boolean; + ownerId: string; +} diff --git a/apps/website/lib/types/generated/LeagueWithCapacityDTO.ts b/apps/website/lib/types/generated/LeagueWithCapacityDTO.ts new file mode 100644 index 000000000..cf040339d --- /dev/null +++ b/apps/website/lib/types/generated/LeagueWithCapacityDTO.ts @@ -0,0 +1,20 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface LeagueWithCapacityDTO { + id: string; + name: string; + nullable: string; + ownerId: string; + type: () => LeagueSettingsDTO }) + @ValidateNested() + @Type(() => LeagueSettingsDTO) + settings: LeagueSettingsDTO; + createdAt: string; + usedSlots: number; + youtubeUrl: string; + websiteUrl: string; +} diff --git a/apps/website/lib/types/generated/MemberPaymentDto.ts b/apps/website/lib/types/generated/MemberPaymentDto.ts new file mode 100644 index 000000000..e657989a0 --- /dev/null +++ b/apps/website/lib/types/generated/MemberPaymentDto.ts @@ -0,0 +1,46 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface MemberPaymentDto { + payment: MemberPaymentDto; + fee: MembershipFeeDto; + payments: PaymentDto[]; + prizes: PrizeDto[]; + prize: PrizeDto; + wallet: WalletDto; + transactions: TransactionDto[]; + transaction: TransactionDto; + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; + type: PaymentDto }) + payment: PaymentDto; + paymentId: string; + enabled: boolean; + updatedAt: string; + feeId: string; + driverId: string; + dueDate: string; + seasonId: string; + position: number; + name: string; + awarded: boolean; + prizeId: string; + success: boolean; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + currency: string; + walletId: string; + description: string; +} diff --git a/apps/website/lib/types/generated/MembershipFeeDto.ts b/apps/website/lib/types/generated/MembershipFeeDto.ts new file mode 100644 index 000000000..904385b4d --- /dev/null +++ b/apps/website/lib/types/generated/MembershipFeeDto.ts @@ -0,0 +1,46 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface MembershipFeeDto { + payment: MemberPaymentDto; + fee: MembershipFeeDto; + payments: PaymentDto[]; + prizes: PrizeDto[]; + prize: PrizeDto; + wallet: WalletDto; + transactions: TransactionDto[]; + transaction: TransactionDto; + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; + type: PaymentDto }) + payment: PaymentDto; + paymentId: string; + enabled: boolean; + updatedAt: string; + feeId: string; + driverId: string; + dueDate: string; + seasonId: string; + position: number; + name: string; + awarded: boolean; + prizeId: string; + success: boolean; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + currency: string; + walletId: string; + description: string; +} diff --git a/apps/website/lib/types/generated/PaymentDto.ts b/apps/website/lib/types/generated/PaymentDto.ts new file mode 100644 index 000000000..e43245ff3 --- /dev/null +++ b/apps/website/lib/types/generated/PaymentDto.ts @@ -0,0 +1,17 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface PaymentDTO { + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; +} diff --git a/apps/website/lib/types/generated/PrizeDto.ts b/apps/website/lib/types/generated/PrizeDto.ts new file mode 100644 index 000000000..f7fb48180 --- /dev/null +++ b/apps/website/lib/types/generated/PrizeDto.ts @@ -0,0 +1,46 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface PrizeDto { + payment: MemberPaymentDto; + fee: MembershipFeeDto; + payments: PaymentDto[]; + prizes: PrizeDto[]; + prize: PrizeDto; + wallet: WalletDto; + transactions: TransactionDto[]; + transaction: TransactionDto; + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; + type: PaymentDto }) + payment: PaymentDto; + paymentId: string; + enabled: boolean; + updatedAt: string; + feeId: string; + driverId: string; + dueDate: string; + seasonId: string; + position: number; + name: string; + awarded: boolean; + prizeId: string; + success: boolean; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + currency: string; + walletId: string; + description: string; +} diff --git a/apps/website/lib/types/generated/ProtestDTO.ts b/apps/website/lib/types/generated/ProtestDTO.ts new file mode 100644 index 000000000..59ffe94d2 --- /dev/null +++ b/apps/website/lib/types/generated/ProtestDTO.ts @@ -0,0 +1,20 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ProtestDTO { + TODO: protests are filed at race level but also managed on league level + +export class ProtestDTO { + @ApiProperty() + @IsString() + id: string; + raceId: string; + protestingDriverId: string; + accusedDriverId: string; + submittedAt: string; + description: string; + enum: string; +} diff --git a/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts b/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts new file mode 100644 index 000000000..6bf3cb1b2 --- /dev/null +++ b/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface QuickPenaltyCommandDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/RaceDTO.ts b/apps/website/lib/types/generated/RaceDTO.ts new file mode 100644 index 000000000..c071d6a42 --- /dev/null +++ b/apps/website/lib/types/generated/RaceDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDTO { + leagueName?: string; + nullable: string; +} diff --git a/apps/website/lib/types/generated/RaceDetailDTO.ts b/apps/website/lib/types/generated/RaceDetailDTO.ts new file mode 100644 index 000000000..0577c426c --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailDTO.ts @@ -0,0 +1,13 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDetailDTO { + nullable: true }) + race!: RaceDetailRaceDTO null; + type: [RaceDetailEntryDTO] }) + entryList!: RaceDetailEntryDTO[]; + required: string; +} diff --git a/apps/website/lib/types/generated/RaceDetailEntryDTO.ts b/apps/website/lib/types/generated/RaceDetailEntryDTO.ts new file mode 100644 index 000000000..974643172 --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailEntryDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDetailEntryDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts b/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts new file mode 100644 index 000000000..349027d31 --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDetailLeagueDTO { + maxDrivers: number; + qualifyingFormat: string; +} diff --git a/apps/website/lib/types/generated/RaceDetailRaceDTO.ts b/apps/website/lib/types/generated/RaceDetailRaceDTO.ts new file mode 100644 index 000000000..04a9184ed --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailRaceDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDetailRaceDTO { + nullable: string; + required: string; +} diff --git a/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts b/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts new file mode 100644 index 000000000..86e6468ae --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceDetailUserResultDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/RacePenaltiesDTO.ts b/apps/website/lib/types/generated/RacePenaltiesDTO.ts new file mode 100644 index 000000000..15ba432f9 --- /dev/null +++ b/apps/website/lib/types/generated/RacePenaltiesDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RacePenaltiesDTO { + type: [RacePenaltyDTO] }) + penalties!: RacePenaltyDTO[]; +} diff --git a/apps/website/lib/types/generated/RacePenaltyDTO.ts b/apps/website/lib/types/generated/RacePenaltyDTO.ts new file mode 100644 index 000000000..0f5b69d31 --- /dev/null +++ b/apps/website/lib/types/generated/RacePenaltyDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RacePenaltyDTO { + notes?: string; + nullable: string; +} diff --git a/apps/website/lib/types/generated/RaceProtestDTO.ts b/apps/website/lib/types/generated/RaceProtestDTO.ts new file mode 100644 index 000000000..3129b0b81 --- /dev/null +++ b/apps/website/lib/types/generated/RaceProtestDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceProtestDTO { + lap: number; + description: string; +} diff --git a/apps/website/lib/types/generated/RaceProtestsDTO.ts b/apps/website/lib/types/generated/RaceProtestsDTO.ts new file mode 100644 index 000000000..d703c841d --- /dev/null +++ b/apps/website/lib/types/generated/RaceProtestsDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceProtestsDTO { + type: [RaceProtestDto] }) + protests!: RaceProtestDto[]; +} diff --git a/apps/website/lib/types/generated/RaceResultsDetailDTO.ts b/apps/website/lib/types/generated/RaceResultsDetailDTO.ts new file mode 100644 index 000000000..eb165aa53 --- /dev/null +++ b/apps/website/lib/types/generated/RaceResultsDetailDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceResultsDetailDTO { + type: [RaceResultDto] }) + results!: RaceResultDto[]; +} diff --git a/apps/website/lib/types/generated/RaceWithSOFDTO.ts b/apps/website/lib/types/generated/RaceWithSOFDTO.ts new file mode 100644 index 000000000..1bfbd0885 --- /dev/null +++ b/apps/website/lib/types/generated/RaceWithSOFDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RaceWithSOFDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/RacesPageDataDTO.ts b/apps/website/lib/types/generated/RacesPageDataDTO.ts new file mode 100644 index 000000000..0ac3a97c8 --- /dev/null +++ b/apps/website/lib/types/generated/RacesPageDataDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RacesPageDataDTO { + type: [RacesPageDataRaceDto] }) + races!: RacesPageDataRaceDto[]; +} diff --git a/apps/website/lib/types/generated/RacesPageDataRaceDTO.ts b/apps/website/lib/types/generated/RacesPageDataRaceDTO.ts new file mode 100644 index 000000000..a72635ecc --- /dev/null +++ b/apps/website/lib/types/generated/RacesPageDataRaceDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RacesPageDataRaceDTO { + nullable: string; +} diff --git a/apps/website/lib/types/generated/RecordEngagementInputDTO.ts b/apps/website/lib/types/generated/RecordEngagementInputDTO.ts new file mode 100644 index 000000000..6627265c3 --- /dev/null +++ b/apps/website/lib/types/generated/RecordEngagementInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RecordEngagementInputDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/RecordPageViewInputDTO.ts b/apps/website/lib/types/generated/RecordPageViewInputDTO.ts new file mode 100644 index 000000000..be7af52f7 --- /dev/null +++ b/apps/website/lib/types/generated/RecordPageViewInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RecordPageViewInputDTO { + enum: string; + required: string; +} diff --git a/apps/website/lib/types/generated/RejectJoinRequestInputDTO.ts b/apps/website/lib/types/generated/RejectJoinRequestInputDTO.ts new file mode 100644 index 000000000..a18ef2518 --- /dev/null +++ b/apps/website/lib/types/generated/RejectJoinRequestInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RejectJoinRequestInputDTO { + requestId: string; + leagueId: string; +} diff --git a/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts b/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts new file mode 100644 index 000000000..bea375ede --- /dev/null +++ b/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RejectJoinRequestOutputDTO { + success: boolean; + required: string; +} diff --git a/apps/website/lib/types/generated/RemoveLeagueMemberInputDTO.ts b/apps/website/lib/types/generated/RemoveLeagueMemberInputDTO.ts new file mode 100644 index 000000000..e0c9e8d4c --- /dev/null +++ b/apps/website/lib/types/generated/RemoveLeagueMemberInputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RemoveLeagueMemberInputDTO { + leagueId: string; + performerDriverId: string; + targetDriverId: string; +} diff --git a/apps/website/lib/types/generated/RemoveLeagueMemberOutputDTO.ts b/apps/website/lib/types/generated/RemoveLeagueMemberOutputDTO.ts new file mode 100644 index 000000000..b5fed9bf2 --- /dev/null +++ b/apps/website/lib/types/generated/RemoveLeagueMemberOutputDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RemoveLeagueMemberOutputDTO { + success: boolean; +} diff --git a/apps/website/lib/types/generated/RequestAvatarGenerationInputDTO.ts b/apps/website/lib/types/generated/RequestAvatarGenerationInputDTO.ts new file mode 100644 index 000000000..f17466e84 --- /dev/null +++ b/apps/website/lib/types/generated/RequestAvatarGenerationInputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RequestAvatarGenerationInputDTO { + userId: string; + facePhotoData: string; + suitColor: string; +} diff --git a/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts b/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts new file mode 100644 index 000000000..a304ff6d0 --- /dev/null +++ b/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface RequestAvatarGenerationOutputDTO { + avatarUrls?: string[]; + type: string; + required: string; +} diff --git a/apps/website/lib/types/generated/SeasonDTO.ts b/apps/website/lib/types/generated/SeasonDTO.ts new file mode 100644 index 000000000..b148fd044 --- /dev/null +++ b/apps/website/lib/types/generated/SeasonDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SeasonDTO { + seasonId: string; + name: string; + leagueId: string; + required: string; + enum: string; + isPrimary: boolean; +} diff --git a/apps/website/lib/types/generated/SponsorDashboardDTO.ts b/apps/website/lib/types/generated/SponsorDashboardDTO.ts new file mode 100644 index 000000000..a25d816b0 --- /dev/null +++ b/apps/website/lib/types/generated/SponsorDashboardDTO.ts @@ -0,0 +1,15 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorDashboardDTO { + metrics: SponsorDashboardMetricsDTO; + sponsoredLeagues: SponsoredLeagueDTO[]; + investment: SponsorDashboardInvestmentDTO; + sponsorId: string; + sponsorName: string; + type: SponsorDashboardMetricsDTO }) + metrics: SponsorDashboardMetricsDTO; +} diff --git a/apps/website/lib/types/generated/SponsorDashboardInvestmentDTO.ts b/apps/website/lib/types/generated/SponsorDashboardInvestmentDTO.ts new file mode 100644 index 000000000..6804a24da --- /dev/null +++ b/apps/website/lib/types/generated/SponsorDashboardInvestmentDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorDashboardInvestmentDTO { + activeSponsorships: number; + totalInvestment: number; + costPerThousandViews: number; +} diff --git a/apps/website/lib/types/generated/SponsorDashboardMetricsDTO.ts b/apps/website/lib/types/generated/SponsorDashboardMetricsDTO.ts new file mode 100644 index 000000000..025ecaf91 --- /dev/null +++ b/apps/website/lib/types/generated/SponsorDashboardMetricsDTO.ts @@ -0,0 +1,16 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorDashboardMetricsDTO { + impressions: number; + impressionsChange: number; + uniqueViewers: number; + viewersChange: number; + races: number; + drivers: number; + exposure: number; + exposureChange: number; +} diff --git a/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts b/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts new file mode 100644 index 000000000..425d70204 --- /dev/null +++ b/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts @@ -0,0 +1,18 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorSponsorshipsDTO { + sponsorships: SponsorshipDetailDTO[]; + sponsorId: string; + sponsorName: string; + type: [SponsorshipDetailDTO] }) + sponsorships: SponsorshipDetailDTO[]; + summary: string; + activeSponsorships: number; + totalInvestment: number; + totalPlatformFees: number; + currency: string; +} diff --git a/apps/website/lib/types/generated/SponsoredLeagueDTO.ts b/apps/website/lib/types/generated/SponsoredLeagueDTO.ts new file mode 100644 index 000000000..d89028b01 --- /dev/null +++ b/apps/website/lib/types/generated/SponsoredLeagueDTO.ts @@ -0,0 +1,14 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsoredLeagueDTO { + id: string; + name: string; + enum: string; + drivers: number; + races: number; + impressions: number; +} diff --git a/apps/website/lib/types/generated/SponsorshipDetailDTO.ts b/apps/website/lib/types/generated/SponsorshipDetailDTO.ts new file mode 100644 index 000000000..97b453595 --- /dev/null +++ b/apps/website/lib/types/generated/SponsorshipDetailDTO.ts @@ -0,0 +1,24 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorshipDetailDTO { + createdAt: string; + id: string; + leagueId: string; + leagueName: string; + seasonId: string; + seasonName: string; + required: string; + enum: string; + pricing: string; + currency: string; + platformFee: string; + netAmount: string; + metrics: string; + races: number; + completedRaces: number; + impressions: number; +} diff --git a/apps/website/lib/types/generated/SponsorshipPricingItemDTO.ts b/apps/website/lib/types/generated/SponsorshipPricingItemDTO.ts new file mode 100644 index 000000000..6ba3dbd32 --- /dev/null +++ b/apps/website/lib/types/generated/SponsorshipPricingItemDTO.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface SponsorshipPricingItemDTO { + id: string; + level: string; + price: number; + currency: string; +} diff --git a/apps/website/lib/types/generated/TeamListItemViewModel.ts b/apps/website/lib/types/generated/TeamListItemViewModel.ts new file mode 100644 index 000000000..c2347837c --- /dev/null +++ b/apps/website/lib/types/generated/TeamListItemViewModel.ts @@ -0,0 +1,29 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface TeamListItemViewModel { + id: string; + name: string; + tag: string; + description: string; + memberCount: number; + leagues: string; + specialization?: string; + region?: string; + languages?: string; + teams: string[]; + totalCount: number; + ownerId: string; + createdAt?: string; + role: string; + joinedAt: string; + isActive: boolean; + team: string; + membership: string; + isOwner: boolean; + canManage: boolean; + success: boolean; +} diff --git a/apps/website/lib/types/generated/TransactionDto.ts b/apps/website/lib/types/generated/TransactionDto.ts new file mode 100644 index 000000000..2fef047cb --- /dev/null +++ b/apps/website/lib/types/generated/TransactionDto.ts @@ -0,0 +1,46 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface TransactionDto { + payment: MemberPaymentDto; + fee: MembershipFeeDto; + payments: PaymentDto[]; + prizes: PrizeDto[]; + prize: PrizeDto; + wallet: WalletDto; + transactions: TransactionDto[]; + transaction: TransactionDto; + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; + type: PaymentDto }) + payment: PaymentDto; + paymentId: string; + enabled: boolean; + updatedAt: string; + feeId: string; + driverId: string; + dueDate: string; + seasonId: string; + position: number; + name: string; + awarded: boolean; + prizeId: string; + success: boolean; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + currency: string; + walletId: string; + description: string; +} diff --git a/apps/website/lib/types/generated/UpdateLeagueMemberRoleInputDTO.ts b/apps/website/lib/types/generated/UpdateLeagueMemberRoleInputDTO.ts new file mode 100644 index 000000000..27485e5db --- /dev/null +++ b/apps/website/lib/types/generated/UpdateLeagueMemberRoleInputDTO.ts @@ -0,0 +1,12 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface UpdateLeagueMemberRoleInputDTO { + leagueId: string; + performerDriverId: string; + targetDriverId: string; + enum: string; +} diff --git a/apps/website/lib/types/generated/UpdateLeagueMemberRoleOutputDTO.ts b/apps/website/lib/types/generated/UpdateLeagueMemberRoleOutputDTO.ts new file mode 100644 index 000000000..fda69856c --- /dev/null +++ b/apps/website/lib/types/generated/UpdateLeagueMemberRoleOutputDTO.ts @@ -0,0 +1,9 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface UpdateLeagueMemberRoleOutputDTO { + success: boolean; +} diff --git a/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts b/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts new file mode 100644 index 000000000..7e37d3d6d --- /dev/null +++ b/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts @@ -0,0 +1,10 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface UpdatePaymentStatusInputDTO { + paymentId: string; + enum: string; +} diff --git a/apps/website/lib/types/generated/UpdatePaymentStatusOutputDTO.ts b/apps/website/lib/types/generated/UpdatePaymentStatusOutputDTO.ts new file mode 100644 index 000000000..06a44389e --- /dev/null +++ b/apps/website/lib/types/generated/UpdatePaymentStatusOutputDTO.ts @@ -0,0 +1,11 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface UpdatePaymentStatusOutputDTO { + payment: PaymentDTO; + type: PaymentDTO }) + payment: PaymentDTO; +} diff --git a/apps/website/lib/types/generated/WalletDto.ts b/apps/website/lib/types/generated/WalletDto.ts new file mode 100644 index 000000000..af2628998 --- /dev/null +++ b/apps/website/lib/types/generated/WalletDto.ts @@ -0,0 +1,46 @@ +/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface WalletDto { + payment: MemberPaymentDto; + fee: MembershipFeeDto; + payments: PaymentDto[]; + prizes: PrizeDto[]; + prize: PrizeDto; + wallet: WalletDto; + transactions: TransactionDto[]; + transaction: TransactionDto; + id: string; + enum: string; + amount: number; + platformFee: number; + netAmount: number; + payerId: string; + leagueId: string; + required: string; + createdAt: string; + type: PaymentDto }) + payment: PaymentDto; + paymentId: string; + enabled: boolean; + updatedAt: string; + feeId: string; + driverId: string; + dueDate: string; + seasonId: string; + position: number; + name: string; + awarded: boolean; + prizeId: string; + success: boolean; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + currency: string; + walletId: string; + description: string; +} diff --git a/apps/website/lib/view-models/index.ts b/apps/website/lib/view-models/index.ts deleted file mode 100644 index 950346555..000000000 --- a/apps/website/lib/view-models/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Analytics ViewModels -export { AnalyticsDashboardViewModel } from './AnalyticsDashboardViewModel'; -export { AnalyticsMetricsViewModel } from './AnalyticsMetricsViewModel'; - -// Auth ViewModels -export { SessionViewModel } from './SessionViewModel'; -export { UserProfileViewModel } from './UserProfileViewModel'; - -// Driver ViewModels -export { DriverLeaderboardItemViewModel } from './DriverLeaderboardItemViewModel'; -export { DriverLeaderboardViewModel } from './DriverLeaderboardViewModel'; -export { DriverRegistrationStatusViewModel } from './DriverRegistrationStatusViewModel'; - -// League ViewModels -export { LeagueMemberViewModel } from './LeagueMemberViewModel'; -export { LeagueStandingsViewModel } from './LeagueStandingsViewModel'; -export { LeagueSummaryViewModel } from './LeagueSummaryViewModel'; -export { StandingEntryViewModel } from './StandingEntryViewModel'; - -// Payments ViewModels -export { MembershipFeeViewModel } from './MembershipFeeViewModel'; -export { PaymentViewModel } from './PaymentViewModel'; -export { PrizeViewModel } from './PrizeViewModel'; -export { WalletTransactionViewModel } from './WalletTransactionViewModel'; -export { WalletViewModel } from './WalletViewModel'; - -// Race ViewModels -export { RaceDetailViewModel } from './RaceDetailViewModel'; -export { RaceListItemViewModel } from './RaceListItemViewModel'; -export { RaceResultViewModel } from './RaceResultViewModel'; -export { RaceResultsDetailViewModel } from './RaceResultsDetailViewModel'; - -// Sponsor ViewModels -export { SponsorViewModel } from './SponsorViewModel'; -export { SponsorDashboardViewModel } from './SponsorDashboardViewModel'; -export { SponsorSponsorshipsViewModel } from './SponsorSponsorshipsViewModel'; -export { SponsorshipDetailViewModel } from './SponsorshipDetailViewModel'; -export { SponsorshipPricingViewModel } from './SponsorshipPricingViewModel'; - -// Team ViewModels -export { TeamDetailsViewModel } from './TeamDetailsViewModel'; -export { TeamJoinRequestViewModel } from './TeamJoinRequestViewModel'; -export { TeamMemberViewModel } from './TeamMemberViewModel'; -export { TeamSummaryViewModel } from './TeamSummaryViewModel'; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9fcb32ea2..798bea47f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -42,8 +42,10 @@ "electron": "^39.2.7", "eslint": "^8.0.0", "eslint-plugin-boundaries": "^5.3.1", + "glob": "^13.0.0", "husky": "^9.1.7", "jsdom": "^22.1.0", + "openapi-typescript": "^7.4.3", "prettier": "^3.0.0", "puppeteer": "^24.31.0", "ts-node": "^10.9.2", @@ -940,6 +942,16 @@ "regexp-match-indices": "1.0.2" } }, + "node_modules/@cucumber/cucumber/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/@cucumber/cucumber/node_modules/commander": { "version": "10.0.1", "resolved": "https://registry.npmjs.org/commander/-/commander-10.0.1.tgz", @@ -950,6 +962,67 @@ "node": ">=14" } }, + "node_modules/@cucumber/cucumber/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@cucumber/cucumber/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/@cucumber/cucumber/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@cucumber/cucumber/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@cucumber/gherkin": { "version": "30.0.4", "resolved": "https://registry.npmjs.org/@cucumber/gherkin/-/gherkin-30.0.4.tgz", @@ -2262,6 +2335,29 @@ "url": "https://opencollective.com/libvips" } }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -2291,18 +2387,6 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, - "node_modules/@isaacs/cliui/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", @@ -2335,23 +2419,6 @@ "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -2967,6 +3034,99 @@ "node": ">=10" } }, + "node_modules/@redocly/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/@redocly/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-EDtsGZS964mf9zAUXAl9Ew16eYbeyAFWhsPr0fX6oaJxgd8rApYlPBf0joyhnUHz88WxrigyFtTaqqzXNzPgqw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@redocly/config": { + "version": "0.22.2", + "resolved": "https://registry.npmjs.org/@redocly/config/-/config-0.22.2.tgz", + "integrity": "sha512-roRDai8/zr2S9YfmzUfNhKjOF0NdcOIqF7bhf4MVC5UxpjIysDjyudvlAiVbpPHp3eDRWbdzUgtkK1a7YiDNyQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@redocly/openapi-core": { + "version": "1.34.6", + "resolved": "https://registry.npmjs.org/@redocly/openapi-core/-/openapi-core-1.34.6.tgz", + "integrity": "sha512-2+O+riuIUgVSuLl3Lyh5AplWZyVMNuG2F98/o6NrutKJfW4/GTZdPpZlIphS0HGgcOHgmWcCSHj+dWFlZaGSHw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/ajv": "^8.11.2", + "@redocly/config": "^0.22.0", + "colorette": "^1.2.0", + "https-proxy-agent": "^7.0.5", + "js-levenshtein": "^1.1.6", + "js-yaml": "^4.1.0", + "minimatch": "^5.0.1", + "pluralize": "^8.0.0", + "yaml-ast-parser": "0.0.43" + }, + "engines": { + "node": ">=18.17.0", + "npm": ">=9.5.0" + } + }, + "node_modules/@redocly/openapi-core/node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14" + } + }, + "node_modules/@redocly/openapi-core/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@redocly/openapi-core/node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" + }, + "engines": { + "node": ">= 14" + } + }, + "node_modules/@redocly/openapi-core/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@rolldown/pluginutils": { "version": "1.0.0-beta.27", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", @@ -4610,6 +4770,16 @@ "node": ">= 6.0.0" } }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.3.tgz", + "integrity": "sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/ansi-regex": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", @@ -5511,6 +5681,13 @@ "node": ">=8" } }, + "node_modules/change-case": { + "version": "5.4.4", + "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", + "integrity": "sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w==", + "dev": true, + "license": "MIT" + }, "node_modules/cheerio": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.1.2.tgz", @@ -5709,6 +5886,13 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "license": "MIT" }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true, + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -7608,6 +7792,23 @@ "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", "license": "MIT" }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/fastq": { "version": "1.19.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", @@ -8133,20 +8334,18 @@ } }, "node_modules/glob": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", - "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", - "license": "ISC", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", + "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", + "minimatch": "^10.1.1", "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" + "path-scurry": "^2.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" + "engines": { + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -8165,25 +8364,17 @@ "node": ">= 6" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/glob/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "license": "ISC", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", + "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -9364,6 +9555,16 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-levenshtein": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz", + "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -9486,6 +9687,13 @@ "dev": true, "license": "MIT" }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true, + "license": "MIT" + }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", @@ -10531,6 +10739,58 @@ "wrappy": "1" } }, + "node_modules/openapi-typescript": { + "version": "7.10.1", + "resolved": "https://registry.npmjs.org/openapi-typescript/-/openapi-typescript-7.10.1.tgz", + "integrity": "sha512-rBcU8bjKGGZQT4K2ekSTY2Q5veOQbVG/lTKZ49DeCyT9z62hM2Vj/LLHjDHC9W7LJG8YMHcdXpRZDqC1ojB/lw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@redocly/openapi-core": "^1.34.5", + "ansi-colors": "^4.1.3", + "change-case": "^5.4.4", + "parse-json": "^8.3.0", + "supports-color": "^10.2.2", + "yargs-parser": "^21.1.1" + }, + "bin": { + "openapi-typescript": "bin/cli.js" + }, + "peerDependencies": { + "typescript": "^5.x" + } + }, + "node_modules/openapi-typescript/node_modules/parse-json": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-8.3.0.tgz", + "integrity": "sha512-ybiGyvspI+fAoRQbIPRddCcSTV9/LsJbf0e/S85VLowVGzRmokfneg2kwVW/KU5rOXrPSbF1qAKPMgNTqqROQQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "index-to-position": "^1.1.0", + "type-fest": "^4.39.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/openapi-typescript/node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/optionator": { "version": "0.9.4", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", @@ -10824,26 +11084,31 @@ "license": "MIT" }, "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.1.tgz", + "integrity": "sha512-oWyT4gICAu+kaA7QWk/jvCHWarMKNs6pXOGWKDTr7cw4IGcUbW+PeTfbaQiLGheFRpjo6O9J0PmyMfQPjH71oA==", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" }, "engines": { - "node": ">=16 || 14 >=14.18" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "license": "ISC" + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } }, "node_modules/path-to-regexp": { "version": "3.3.0", @@ -11072,6 +11337,16 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/pluralize": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", + "integrity": "sha512-Nc3IT5yHzflTfbjgqWcCPpo7DaKy4FnpB0l/zCAW0Tc7jxAiuqSxHasntB3D7887LSrA93kDJ9IXovxJYxyLCA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/possible-typed-array-names": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", @@ -12043,6 +12318,16 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", @@ -14508,6 +14793,15 @@ } } }, + "node_modules/typeorm/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, "node_modules/typeorm/node_modules/buffer": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", @@ -14532,6 +14826,63 @@ "ieee754": "^1.2.1" } }, + "node_modules/typeorm/node_modules/glob": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", + "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^3.1.2", + "minimatch": "^9.0.4", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^1.11.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typeorm/node_modules/lru-cache": { + "version": "10.4.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "license": "ISC" + }, + "node_modules/typeorm/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/typeorm/node_modules/path-scurry": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^10.2.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.18" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typeorm/node_modules/uuid": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", @@ -15204,6 +15555,23 @@ "dev": true, "license": "MIT" }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", @@ -15222,6 +15590,62 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", + "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", + "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -15316,6 +15740,13 @@ "url": "https://github.com/sponsors/eemeli" } }, + "node_modules/yaml-ast-parser": { + "version": "0.0.43", + "resolved": "https://registry.npmjs.org/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz", + "integrity": "sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/package.json b/package.json index ff8601474..081a9f1cc 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,9 @@ "docker:prod:logs": "docker-compose -f docker-compose.prod.yml logs -f", "docker:prod:clean": "docker-compose -f docker-compose.prod.yml down -v", "api:build": "npm run build --workspace=@gridpilot/api", + "api:generate-spec": "tsx scripts/generate-openapi-from-dtos.ts", + "api:generate-types": "tsx scripts/generate-api-types.ts", + "api:sync-types": "npm run api:generate-spec && npm run api:generate-types", "test": "vitest run \"$@\"", "test:unit": "vitest run tests/unit", "test:integration": "vitest run tests/integration", @@ -78,8 +81,10 @@ "electron": "^39.2.7", "eslint": "^8.0.0", "eslint-plugin-boundaries": "^5.3.1", + "glob": "^13.0.0", "husky": "^9.1.7", "jsdom": "^22.1.0", + "openapi-typescript": "^7.4.3", "prettier": "^3.0.0", "puppeteer": "^24.31.0", "ts-node": "^10.9.2", diff --git a/scripts/generate-api-types.ts b/scripts/generate-api-types.ts new file mode 100644 index 000000000..187935876 --- /dev/null +++ b/scripts/generate-api-types.ts @@ -0,0 +1,113 @@ +#!/usr/bin/env tsx +import fs from 'fs/promises'; +import path from 'path'; + +async function generateIndividualDTOs() { + const openapiPath = path.join(__dirname, '../apps/api/openapi.json'); + const outputDir = path.join(__dirname, '../apps/website/lib/types/generated'); + + console.log('🔄 Generating individual DTO files from OpenAPI spec...'); + + try { + // Check if OpenAPI spec exists + await fs.access(openapiPath); + } catch { + console.error(`❌ OpenAPI spec not found at: ${openapiPath}`); + console.error('Run "npm run api:generate-spec" first'); + process.exit(1); + } + + try { + // Read the OpenAPI spec + const specContent = await fs.readFile(openapiPath, 'utf-8'); + const spec = JSON.parse(specContent); + + // Ensure output directory exists + await fs.mkdir(outputDir, { recursive: true }); + + // Extract schemas from the spec + const schemas = spec.components?.schemas || {}; + + console.log(`📝 Found ${Object.keys(schemas).length} schemas to generate`); + + // Generate individual files for each schema + for (const [schemaName, schema] of Object.entries(schemas)) { + if (typeof schema === 'object' && schema !== null) { + const fileName = `${schemaName}.ts`; + const filePath = path.join(outputDir, fileName); + + // Convert OpenAPI schema to TypeScript interface + const tsInterface = generateTypeScriptInterface(schemaName, schema); + + await fs.writeFile(filePath, tsInterface); + console.log(`✅ Generated ${fileName}`); + } + } + + console.log(`🎉 Generated ${Object.keys(schemas).length} DTO files in ${outputDir}`); + + } catch (error) { + console.error('❌ Failed to generate DTOs:', error); + process.exit(1); + } +} + +function generateTypeScriptInterface(name: string, schema: any): string { + const properties = schema.properties || {}; + const required = schema.required || []; + + let interfaceContent = `/** + * Auto-generated DTO from OpenAPI spec + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +export interface ${name} {\n`; + + for (const [propName, propSchema] of Object.entries(properties)) { + const isRequired = required.includes(propName); + const optionalMark = isRequired ? '' : '?'; + const type = openApiTypeToTypeScript(propSchema); + + interfaceContent += ` ${propName}${optionalMark}: ${type};\n`; + } + + interfaceContent += '}\n'; + + return interfaceContent; +} + +function openApiTypeToTypeScript(schema: any): string { + if (schema.$ref) { + // Handle references + const refName = schema.$ref.split('/').pop(); + return refName; + } + + if (schema.type === 'array') { + const itemType = openApiTypeToTypeScript(schema.items); + return `${itemType}[]`; + } + + if (schema.type === 'object') { + // For complex objects, we'll use a generic Record for now + return 'Record'; + } + + switch (schema.type) { + case 'string': + if (schema.format === 'date-time') { + return 'string'; // Keep as string for now, could be Date + } + return 'string'; + case 'number': + case 'integer': + return 'number'; + case 'boolean': + return 'boolean'; + default: + return 'any'; + } +} + +generateIndividualDTOs().catch(console.error); \ No newline at end of file diff --git a/scripts/generate-openapi-from-dtos.ts b/scripts/generate-openapi-from-dtos.ts new file mode 100644 index 000000000..7b6d9ef81 --- /dev/null +++ b/scripts/generate-openapi-from-dtos.ts @@ -0,0 +1,283 @@ +#!/usr/bin/env tsx +import fs from 'fs/promises'; +import path from 'path'; +import { glob } from 'glob'; + +// Comprehensive OpenAPI spec generator that scans all DTO files +async function generateComprehensiveOpenAPISpec() { + console.log('🔄 Generating comprehensive OpenAPI spec from all DTO files...'); + + const schemas: Record = {}; + + // Find all DTO files in the API + const dtoFiles = await glob('apps/api/src/domain/*/dtos/**/*.ts', { + cwd: path.join(__dirname, '..') + }); + + console.log(`📁 Found ${dtoFiles.length} DTO files to process`); + + for (const dtoFile of dtoFiles) { + const filePath = path.join(__dirname, '..', dtoFile); + await processDTOFile(filePath, schemas); + } + + // Also check for DTOs in other locations + const additionalDtoFiles = await glob('apps/api/src/domain/*/*.ts', { + cwd: path.join(__dirname, '..') + }); + + for (const dtoFile of additionalDtoFiles) { + if (dtoFile.includes('dto') || dtoFile.includes('DTO')) { + const filePath = path.join(__dirname, '..', dtoFile); + await processDTOFile(filePath, schemas); + } + } + + const spec = { + openapi: '3.0.0', + info: { + title: 'GridPilot API', + description: 'GridPilot API documentation', + version: '1.0.0' + }, + paths: {}, + components: { + schemas + } + }; + + const outputPath = path.join(__dirname, '../apps/api/openapi.json'); + await fs.writeFile(outputPath, JSON.stringify(spec, null, 2)); + + console.log(`✅ Comprehensive OpenAPI spec generated with ${Object.keys(schemas).length} schemas at: ${outputPath}`); +} + +async function processDTOFile(filePath: string, schemas: Record) { + try { + const content = await fs.readFile(filePath, 'utf-8'); + + // Extract all class and interface definitions + const classMatches = content.match(/export (?:class|interface) (\w+(?:DTO|Dto))/g); + if (!classMatches) { + // Debug: check if file has any export statements + if (content.includes('export')) { + console.log(`📄 ${filePath} has exports but no DTO classes`); + } + return; + } + + console.log(`📄 Processing ${filePath} - found ${classMatches.length} DTO classes`); + + for (const classMatch of classMatches) { + const classNameMatch = classMatch.match(/export (?:class|interface) (\w+(?:DTO|Dto))/); + if (classNameMatch) { + const className = classNameMatch[1]; + console.log(` 🔍 Extracting schema for ${className}`); + const schema = extractSchemaFromClass(content, className); + if (schema && Object.keys(schema.properties || {}).length > 0) { + schemas[className] = schema; + console.log(` ✅ Added schema for ${className} with ${Object.keys(schema.properties).length} properties`); + } else { + console.log(` ⚠️ No schema generated for ${className}`); + } + } + } + } catch (error) { + // File can't be read, continue + console.warn(`⚠️ Could not process ${filePath}:`, error.message); + } +} + +function extractSchemaFromClass(content: string, className: string): any | null { + const properties: Record = {}; + const required: string[] = []; + + // Extract @ApiProperty decorated properties from NestJS DTOs + // Pattern: @ApiProperty(...) followed by property declaration + const lines = content.split('\n'); + let i = 0; + + while (i < lines.length) { + const line = lines[i].trim(); + + // Look for @ApiProperty decorator + if (line.startsWith('@ApiProperty(')) { + const decoratorMatch = line.match(/@ApiProperty\(([^)]*)\)/); + if (decoratorMatch) { + const decoratorContent = decoratorMatch[1]; + + // Find the property declaration (could be on next line) + let propertyLine = line; + if (!line.includes(';')) { + i++; + if (i < lines.length) { + propertyLine = lines[i].trim(); + } + } + + // Extract property name and type from declaration + const propertyMatch = propertyLine.match(/(\w+)\s*\??:\s*([^;]+);/); + if (propertyMatch) { + const propertyName = propertyMatch[1]; + const propertyType = propertyMatch[2].trim(); + + // Check if property is required + const isOptional = propertyName.includes('?') || + decoratorContent.includes('required: false') || + decoratorContent.includes('nullable: true') || + propertyLine.includes('@IsOptional()'); + + if (!isOptional) { + required.push(propertyName); + } + + // Try to extract type from decorator first, then fall back to property type + let schemaType = extractTypeFromDecorator(decoratorContent); + if (!schemaType) { + schemaType = mapTypeToSchema(propertyType); + } + + properties[propertyName] = schemaType; + } + } + } + + i++; + } + + // Also extract interface properties (for existing interfaces) + const interfacePropertyRegex = /(\w+)\s*\??:\s*([^;]+);/g; + let match; + while ((match = interfacePropertyRegex.exec(content)) !== null) { + const propertyName = match[1]; + const propertyType = match[2].trim(); + + if (!properties[propertyName]) { + // Check if property is required + if (!propertyName.includes('?')) { + required.push(propertyName); + } + + properties[propertyName] = mapTypeToSchema(propertyType); + } + } + + if (Object.keys(properties).length === 0) { + return null; + } + + const schema: any = { + type: 'object', + properties + }; + + if (required.length > 0) { + schema.required = required; + } + + return schema; +} + +function extractTypeFromDecorator(decoratorContent: string): any | null { + // Extract type information from @ApiProperty decorator + // Examples: + // @ApiProperty({ type: String }) + // @ApiProperty({ type: [SomeDTO] }) + // @ApiProperty({ type: () => SomeDTO }) + + if (decoratorContent.includes('type:')) { + // Simple type extraction - this is a simplified version + // In a real implementation, you'd want proper AST parsing + + if (decoratorContent.includes('[String]') || decoratorContent.includes('[string]')) { + return { type: 'array', items: { type: 'string' } }; + } + + if (decoratorContent.includes('[Number]') || decoratorContent.includes('[number]')) { + return { type: 'array', items: { type: 'number' } }; + } + + if (decoratorContent.includes('String') || decoratorContent.includes('string')) { + return { type: 'string' }; + } + + if (decoratorContent.includes('Number') || decoratorContent.includes('number')) { + return { type: 'number' }; + } + + if (decoratorContent.includes('Boolean') || decoratorContent.includes('boolean')) { + return { type: 'boolean' }; + } + + // For complex types with references + const refMatch = decoratorContent.match(/type:\s*\[?(\w+DTO)\]?/); + if (refMatch) { + const refType = refMatch[1]; + if (decoratorContent.includes('[')) { + return { type: 'array', items: { $ref: `#/components/schemas/${refType}` } }; + } else { + return { $ref: `#/components/schemas/${refType}` }; + } + } + + // For function types like type: () => SomeDTO + const funcMatch = decoratorContent.match(/type:\s*\(\)\s*=>\s*(\w+DTO)/); + if (funcMatch) { + return { $ref: `#/components/schemas/${funcMatch[1]}` }; + } + } + + return null; +} + +function mapTypeToSchema(type: string): any { + // Clean up the type + type = type.replace(/[|;]/g, '').trim(); + + // Handle array types + if (type.endsWith('[]')) { + const itemType = type.slice(0, -2); + return { + type: 'array', + items: mapTypeToSchema(itemType) + }; + } + + // Handle union types (simplified) + if (type.includes('|')) { + const types = type.split('|').map(t => t.trim()); + if (types.length === 2 && types.includes('null')) { + // Nullable type + const nonNullType = types.find(t => t !== 'null'); + return mapTypeToSchema(nonNullType!); + } + return { + oneOf: types.map(t => mapTypeToSchema(t)) + }; + } + + // Handle basic types + switch (type.toLowerCase()) { + case 'string': + return { type: 'string' }; + case 'number': + case 'bigint': + return { type: 'number' }; + case 'boolean': + return { type: 'boolean' }; + case 'date': + return { type: 'string', format: 'date-time' }; + case 'any': + case 'unknown': + return {}; + default: + // For complex types, assume they're other DTOs + if (type.includes('DTO') || type.includes('Dto')) { + return { $ref: `#/components/schemas/${type}` }; + } + // For other types, use string as fallback + return { type: 'string' }; + } +} + +generateComprehensiveOpenAPISpec().catch(console.error); \ No newline at end of file diff --git a/scripts/generate-openapi-spec.ts b/scripts/generate-openapi-spec.ts new file mode 100644 index 000000000..7b6d9ef81 --- /dev/null +++ b/scripts/generate-openapi-spec.ts @@ -0,0 +1,283 @@ +#!/usr/bin/env tsx +import fs from 'fs/promises'; +import path from 'path'; +import { glob } from 'glob'; + +// Comprehensive OpenAPI spec generator that scans all DTO files +async function generateComprehensiveOpenAPISpec() { + console.log('🔄 Generating comprehensive OpenAPI spec from all DTO files...'); + + const schemas: Record = {}; + + // Find all DTO files in the API + const dtoFiles = await glob('apps/api/src/domain/*/dtos/**/*.ts', { + cwd: path.join(__dirname, '..') + }); + + console.log(`📁 Found ${dtoFiles.length} DTO files to process`); + + for (const dtoFile of dtoFiles) { + const filePath = path.join(__dirname, '..', dtoFile); + await processDTOFile(filePath, schemas); + } + + // Also check for DTOs in other locations + const additionalDtoFiles = await glob('apps/api/src/domain/*/*.ts', { + cwd: path.join(__dirname, '..') + }); + + for (const dtoFile of additionalDtoFiles) { + if (dtoFile.includes('dto') || dtoFile.includes('DTO')) { + const filePath = path.join(__dirname, '..', dtoFile); + await processDTOFile(filePath, schemas); + } + } + + const spec = { + openapi: '3.0.0', + info: { + title: 'GridPilot API', + description: 'GridPilot API documentation', + version: '1.0.0' + }, + paths: {}, + components: { + schemas + } + }; + + const outputPath = path.join(__dirname, '../apps/api/openapi.json'); + await fs.writeFile(outputPath, JSON.stringify(spec, null, 2)); + + console.log(`✅ Comprehensive OpenAPI spec generated with ${Object.keys(schemas).length} schemas at: ${outputPath}`); +} + +async function processDTOFile(filePath: string, schemas: Record) { + try { + const content = await fs.readFile(filePath, 'utf-8'); + + // Extract all class and interface definitions + const classMatches = content.match(/export (?:class|interface) (\w+(?:DTO|Dto))/g); + if (!classMatches) { + // Debug: check if file has any export statements + if (content.includes('export')) { + console.log(`📄 ${filePath} has exports but no DTO classes`); + } + return; + } + + console.log(`📄 Processing ${filePath} - found ${classMatches.length} DTO classes`); + + for (const classMatch of classMatches) { + const classNameMatch = classMatch.match(/export (?:class|interface) (\w+(?:DTO|Dto))/); + if (classNameMatch) { + const className = classNameMatch[1]; + console.log(` 🔍 Extracting schema for ${className}`); + const schema = extractSchemaFromClass(content, className); + if (schema && Object.keys(schema.properties || {}).length > 0) { + schemas[className] = schema; + console.log(` ✅ Added schema for ${className} with ${Object.keys(schema.properties).length} properties`); + } else { + console.log(` ⚠️ No schema generated for ${className}`); + } + } + } + } catch (error) { + // File can't be read, continue + console.warn(`⚠️ Could not process ${filePath}:`, error.message); + } +} + +function extractSchemaFromClass(content: string, className: string): any | null { + const properties: Record = {}; + const required: string[] = []; + + // Extract @ApiProperty decorated properties from NestJS DTOs + // Pattern: @ApiProperty(...) followed by property declaration + const lines = content.split('\n'); + let i = 0; + + while (i < lines.length) { + const line = lines[i].trim(); + + // Look for @ApiProperty decorator + if (line.startsWith('@ApiProperty(')) { + const decoratorMatch = line.match(/@ApiProperty\(([^)]*)\)/); + if (decoratorMatch) { + const decoratorContent = decoratorMatch[1]; + + // Find the property declaration (could be on next line) + let propertyLine = line; + if (!line.includes(';')) { + i++; + if (i < lines.length) { + propertyLine = lines[i].trim(); + } + } + + // Extract property name and type from declaration + const propertyMatch = propertyLine.match(/(\w+)\s*\??:\s*([^;]+);/); + if (propertyMatch) { + const propertyName = propertyMatch[1]; + const propertyType = propertyMatch[2].trim(); + + // Check if property is required + const isOptional = propertyName.includes('?') || + decoratorContent.includes('required: false') || + decoratorContent.includes('nullable: true') || + propertyLine.includes('@IsOptional()'); + + if (!isOptional) { + required.push(propertyName); + } + + // Try to extract type from decorator first, then fall back to property type + let schemaType = extractTypeFromDecorator(decoratorContent); + if (!schemaType) { + schemaType = mapTypeToSchema(propertyType); + } + + properties[propertyName] = schemaType; + } + } + } + + i++; + } + + // Also extract interface properties (for existing interfaces) + const interfacePropertyRegex = /(\w+)\s*\??:\s*([^;]+);/g; + let match; + while ((match = interfacePropertyRegex.exec(content)) !== null) { + const propertyName = match[1]; + const propertyType = match[2].trim(); + + if (!properties[propertyName]) { + // Check if property is required + if (!propertyName.includes('?')) { + required.push(propertyName); + } + + properties[propertyName] = mapTypeToSchema(propertyType); + } + } + + if (Object.keys(properties).length === 0) { + return null; + } + + const schema: any = { + type: 'object', + properties + }; + + if (required.length > 0) { + schema.required = required; + } + + return schema; +} + +function extractTypeFromDecorator(decoratorContent: string): any | null { + // Extract type information from @ApiProperty decorator + // Examples: + // @ApiProperty({ type: String }) + // @ApiProperty({ type: [SomeDTO] }) + // @ApiProperty({ type: () => SomeDTO }) + + if (decoratorContent.includes('type:')) { + // Simple type extraction - this is a simplified version + // In a real implementation, you'd want proper AST parsing + + if (decoratorContent.includes('[String]') || decoratorContent.includes('[string]')) { + return { type: 'array', items: { type: 'string' } }; + } + + if (decoratorContent.includes('[Number]') || decoratorContent.includes('[number]')) { + return { type: 'array', items: { type: 'number' } }; + } + + if (decoratorContent.includes('String') || decoratorContent.includes('string')) { + return { type: 'string' }; + } + + if (decoratorContent.includes('Number') || decoratorContent.includes('number')) { + return { type: 'number' }; + } + + if (decoratorContent.includes('Boolean') || decoratorContent.includes('boolean')) { + return { type: 'boolean' }; + } + + // For complex types with references + const refMatch = decoratorContent.match(/type:\s*\[?(\w+DTO)\]?/); + if (refMatch) { + const refType = refMatch[1]; + if (decoratorContent.includes('[')) { + return { type: 'array', items: { $ref: `#/components/schemas/${refType}` } }; + } else { + return { $ref: `#/components/schemas/${refType}` }; + } + } + + // For function types like type: () => SomeDTO + const funcMatch = decoratorContent.match(/type:\s*\(\)\s*=>\s*(\w+DTO)/); + if (funcMatch) { + return { $ref: `#/components/schemas/${funcMatch[1]}` }; + } + } + + return null; +} + +function mapTypeToSchema(type: string): any { + // Clean up the type + type = type.replace(/[|;]/g, '').trim(); + + // Handle array types + if (type.endsWith('[]')) { + const itemType = type.slice(0, -2); + return { + type: 'array', + items: mapTypeToSchema(itemType) + }; + } + + // Handle union types (simplified) + if (type.includes('|')) { + const types = type.split('|').map(t => t.trim()); + if (types.length === 2 && types.includes('null')) { + // Nullable type + const nonNullType = types.find(t => t !== 'null'); + return mapTypeToSchema(nonNullType!); + } + return { + oneOf: types.map(t => mapTypeToSchema(t)) + }; + } + + // Handle basic types + switch (type.toLowerCase()) { + case 'string': + return { type: 'string' }; + case 'number': + case 'bigint': + return { type: 'number' }; + case 'boolean': + return { type: 'boolean' }; + case 'date': + return { type: 'string', format: 'date-time' }; + case 'any': + case 'unknown': + return {}; + default: + // For complex types, assume they're other DTOs + if (type.includes('DTO') || type.includes('Dto')) { + return { $ref: `#/components/schemas/${type}` }; + } + // For other types, use string as fallback + return { type: 'string' }; + } +} + +generateComprehensiveOpenAPISpec().catch(console.error); \ No newline at end of file