From f7a56a92ceeddefe7ea8f2bc0073ac830528fa66 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Wed, 17 Dec 2025 23:37:51 +0100 Subject: [PATCH] services refactor --- apps/api/openapi.json | 2816 +++++------------ apps/api/src/main.ts | 4 +- .../AllLeaguesWithCapacityAndScoringDTO.ts | 14 - .../generated/AllLeaguesWithCapacityDTO.ts | 14 - .../types/generated/ApplyPenaltyCommandDTO.ts | 4 +- .../generated/ApproveJoinRequestOutputDTO.ts | 1 - .../lib/types/generated/AuthSessionDTO.ts | 9 +- .../types/generated/AuthenticatedUserDTO.ts | 8 +- .../generated/CompleteOnboardingInputDto.ts | 1 - .../generated/CompleteOnboardingOutputDTO.ts | 1 - .../types/generated/CreateLeagueInputDTO.ts | 2 - .../types/generated/CreateSponsorInputDTO.ts | 1 - .../types/generated/CreateSponsorOutputDTO.ts | 11 - .../generated/DashboardDriverSummaryDTO.ts | 5 +- .../generated/DashboardFeedItemSummaryDTO.ts | 2 +- .../generated/DashboardFeedSummaryDTO.ts | 3 +- ...verDto.ts => DashboardFriendSummaryDTO.ts} | 7 +- ...s => DashboardLeagueStandingSummaryDTO.ts} | 10 +- .../types/generated/DashboardOverviewDTO.ts | 12 - .../generated/DashboardRaceSummaryDTO.ts | 7 +- .../generated/DashboardRecentResultDTO.ts | 15 + .../generated/DriverLeaderboardItemDTO.ts | 2 - ...tDTO.ts => DriverRegistrationStatusDTO.ts} | 8 +- .../types/generated/DriversLeaderboardDTO.ts | 14 - .../types/generated/FileProtestCommandDTO.ts | 7 +- .../GetEntitySponsorshipPricingResultDTO.ts | 11 - .../GetLeagueAdminConfigOutputDTO.ts | 13 - ...putDTO.ts => GetRaceDetailParamsDTODTO.ts} | 6 +- .../types/generated/GetSponsorsOutputDTO.ts | 11 - ...sSummaryDTO.ts => ImportRaceResultsDTO.ts} | 6 +- .../types/generated/LeagueAdminConfigDTO.ts | 13 - .../lib/types/generated/LeagueAdminDTO.ts | 13 - .../types/generated/LeagueAdminProtestsDTO.ts | 13 - .../LeagueConfigFormModelBasicsDTO.ts | 1 - .../generated/LeagueConfigFormModelDTO.ts | 4 - .../LeagueConfigFormModelStewardingDTO.ts | 17 - .../types/generated/LeagueJoinRequestDTO.ts | 7 +- .../lib/types/generated/LeagueMemberDTO.ts | 6 - .../types/generated/LeagueMembershipsDTO.ts | 13 - .../types/generated/LeagueOwnerSummaryDTO.ts | 13 - .../lib/types/generated/LeagueScheduleDTO.ts | 13 - .../types/generated/LeagueSeasonSummaryDTO.ts | 3 - .../lib/types/generated/LeagueStandingDTO.ts | 6 - .../lib/types/generated/LeagueStandingsDTO.ts | 13 - .../lib/types/generated/LeagueSummaryDTO.ts | 5 - .../types/generated/LeagueWithCapacityDTO.ts | 10 - .../lib/types/generated/MemberPaymentDto.ts | 36 +- .../lib/types/generated/MembershipFeeDto.ts | 36 - .../website/lib/types/generated/PaymentDto.ts | 8 - apps/website/lib/types/generated/PrizeDto.ts | 34 +- .../website/lib/types/generated/ProtestDTO.ts | 7 +- .../types/generated/QuickPenaltyCommandDTO.ts | 5 +- ...eSettingsDTO.ts => RaceActionParamsDTO.ts} | 4 +- apps/website/lib/types/generated/RaceDTO.ts | 5 +- .../lib/types/generated/RaceDetailDTO.ts | 13 - .../lib/types/generated/RaceDetailEntryDTO.ts | 5 +- .../types/generated/RaceDetailLeagueDTO.ts | 8 +- .../lib/types/generated/RaceDetailRaceDTO.ts | 9 +- .../generated/RaceDetailRegistrationDTO.ts | 10 + .../generated/RaceDetailUserResultDTO.ts | 8 +- .../lib/types/generated/RacePenaltiesDTO.ts | 10 - .../lib/types/generated/RacePenaltyDTO.ts | 9 +- .../lib/types/generated/RaceProtestDTO.ts | 4 + .../lib/types/generated/RaceProtestsDTO.ts | 10 - .../lib/types/generated/RaceResultDTO.ts | 18 + .../types/generated/RaceResultsDetailDTO.ts | 4 +- .../{AllRacesPageDTO.ts => RaceStatsDTO.ts} | 4 +- .../lib/types/generated/RaceWithSOFDTO.ts | 3 +- .../lib/types/generated/RacesPageDataDTO.ts | 10 - .../types/generated/RacesPageDataRaceDTO.ts | 8 +- ...icyDTO.ts => RecordEngagementOutputDTO.ts} | 6 +- ...InputDTO.ts => RecordPageViewOutputDTO.ts} | 5 +- .../generated/RegisterForRaceParamsDTO.ts | 11 + .../generated/RejectJoinRequestOutputDTO.ts | 1 - .../RequestAvatarGenerationOutputDTO.ts | 11 - .../RequestProtestDefenseCommandDTO.ts | 10 + apps/website/lib/types/generated/SeasonDTO.ts | 3 - .../types/generated/SponsorDashboardDTO.ts | 5 - .../types/generated/SponsorSponsorshipsDTO.ts | 8 - .../lib/types/generated/SponsoredLeagueDTO.ts | 4 - .../types/generated/SponsorshipDetailDTO.ts | 11 - .../types/generated/TeamListItemViewModel.ts | 29 - .../lib/types/generated/TransactionDto.ts | 36 - .../UpdateLeagueMemberRoleInputDTO.ts | 1 - .../generated/UpdatePaymentStatusInputDTO.ts | 1 - .../generated/UpdatePaymentStatusOutputDTO.ts | 11 - apps/website/lib/types/generated/WalletDto.ts | 33 +- ...putDto.ts => WithdrawFromRaceParamsDTO.ts} | 6 +- apps/website/lib/types/generated/api.ts | 469 +++ apps/website/lib/types/generated/index.ts | 99 + package.json | 2 +- scripts/generate-api-types.ts | 243 +- scripts/generate-openapi-from-dtos.ts | 283 -- scripts/generate-openapi-spec.ts | 357 +-- 94 files changed, 1894 insertions(+), 3194 deletions(-) delete mode 100644 apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts delete mode 100644 apps/website/lib/types/generated/AllLeaguesWithCapacityDTO.ts delete mode 100644 apps/website/lib/types/generated/CreateSponsorOutputDTO.ts rename apps/website/lib/types/generated/{DriverDto.ts => DashboardFriendSummaryDTO.ts} (69%) rename apps/website/lib/types/generated/{CreatePaymentInputDTO.ts => DashboardLeagueStandingSummaryDTO.ts} (58%) delete mode 100644 apps/website/lib/types/generated/DashboardOverviewDTO.ts create mode 100644 apps/website/lib/types/generated/DashboardRecentResultDTO.ts rename apps/website/lib/types/generated/{CreatePaymentOutputDTO.ts => DriverRegistrationStatusDTO.ts} (61%) delete mode 100644 apps/website/lib/types/generated/DriversLeaderboardDTO.ts delete mode 100644 apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts delete mode 100644 apps/website/lib/types/generated/GetLeagueAdminConfigOutputDTO.ts rename apps/website/lib/types/generated/{RecordEngagementInputDTO.ts => GetRaceDetailParamsDTODTO.ts} (68%) delete mode 100644 apps/website/lib/types/generated/GetSponsorsOutputDTO.ts rename apps/website/lib/types/generated/{ImportRaceResultsSummaryDTO.ts => ImportRaceResultsDTO.ts} (66%) delete mode 100644 apps/website/lib/types/generated/LeagueAdminConfigDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueAdminDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueMembershipsDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueOwnerSummaryDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueScheduleDTO.ts delete mode 100644 apps/website/lib/types/generated/LeagueStandingsDTO.ts rename apps/website/lib/types/generated/{LeagueSettingsDTO.ts => RaceActionParamsDTO.ts} (75%) delete mode 100644 apps/website/lib/types/generated/RaceDetailDTO.ts create mode 100644 apps/website/lib/types/generated/RaceDetailRegistrationDTO.ts delete mode 100644 apps/website/lib/types/generated/RacePenaltiesDTO.ts delete mode 100644 apps/website/lib/types/generated/RaceProtestsDTO.ts create mode 100644 apps/website/lib/types/generated/RaceResultDTO.ts rename apps/website/lib/types/generated/{AllRacesPageDTO.ts => RaceStatsDTO.ts} (76%) delete mode 100644 apps/website/lib/types/generated/RacesPageDataDTO.ts rename apps/website/lib/types/generated/{LeagueConfigFormModelDropPolicyDTO.ts => RecordEngagementOutputDTO.ts} (65%) rename apps/website/lib/types/generated/{RecordPageViewInputDTO.ts => RecordPageViewOutputDTO.ts} (69%) create mode 100644 apps/website/lib/types/generated/RegisterForRaceParamsDTO.ts delete mode 100644 apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts create mode 100644 apps/website/lib/types/generated/RequestProtestDefenseCommandDTO.ts delete mode 100644 apps/website/lib/types/generated/TeamListItemViewModel.ts delete mode 100644 apps/website/lib/types/generated/UpdatePaymentStatusOutputDTO.ts rename apps/website/lib/types/generated/{CreateDriverOutputDto.ts => WithdrawFromRaceParamsDTO.ts} (68%) create mode 100644 apps/website/lib/types/generated/api.ts create mode 100644 apps/website/lib/types/generated/index.ts delete mode 100644 scripts/generate-openapi-from-dtos.ts diff --git a/apps/api/openapi.json b/apps/api/openapi.json index 91fefe2e5..ea1e3e8ba 100644 --- a/apps/api/openapi.json +++ b/apps/api/openapi.json @@ -34,10 +34,6 @@ "SponsorshipDetailDTO": { "type": "object", "properties": { - "createdAt": { - "type": "string", - "format": "date-time" - }, "id": { "type": "string" }, @@ -52,55 +48,14 @@ }, "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" + "seasonName" ] }, "SponsoredLeagueDTO": { @@ -111,76 +66,26 @@ }, "name": { "type": "string" - }, - "enum": { - "type": "string" - }, - "drivers": { - "type": "number" - }, - "races": { - "type": "number" - }, - "impressions": { - "type": "number" } }, "required": [ "id", - "name", - "enum", - "drivers", - "races", - "impressions" + "name" ] }, "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" + "sponsorName" ] }, "SponsorDashboardMetricsDTO": { @@ -244,56 +149,16 @@ "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" + "sponsorName" ] }, "GetSponsorSponsorshipsQueryParamsDTO": { @@ -318,42 +183,6 @@ "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": { @@ -362,84 +191,365 @@ }, "contactEmail": { "type": "string" - }, - "required": { - "type": "string" } }, "required": [ "name", - "contactEmail", - "required" + "contactEmail" + ] + }, + "UpdatePaymentStatusInputDTO": { + "type": "object", + "properties": { + "paymentId": { + "type": "string" + } + }, + "required": [ + "paymentId" + ] + }, + "PaymentDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "MembershipFeeDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + } + }, + "required": [ + "id", + "leagueId" + ] + }, + "MemberPaymentDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "feeId": { + "type": "string" + }, + "driverId": { + "type": "string" + }, + "amount": { + "type": "number" + }, + "platformFee": { + "type": "number" + }, + "netAmount": { + "type": "number" + } + }, + "required": [ + "id", + "feeId", + "driverId", + "amount", + "platformFee", + "netAmount" + ] + }, + "PrizeDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "seasonId": { + "type": "string" + }, + "position": { + "type": "number" + }, + "name": { + "type": "string" + }, + "amount": { + "type": "number" + } + }, + "required": [ + "id", + "leagueId", + "seasonId", + "position", + "name", + "amount" + ] + }, + "WalletDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "balance": { + "type": "number" + }, + "totalRevenue": { + "type": "number" + }, + "totalPlatformFees": { + "type": "number" + }, + "totalWithdrawn": { + "type": "number" + }, + "createdAt": { + "type": "string", + "format": "date-time" + }, + "currency": { + "type": "string" + } + }, + "required": [ + "id", + "leagueId", + "balance", + "totalRevenue", + "totalPlatformFees", + "totalWithdrawn", + "createdAt", + "currency" + ] + }, + "TransactionDto": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "walletId": { + "type": "string" + } + }, + "required": [ + "id", + "walletId" + ] + }, + "PaymentDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "required": [ + "id" + ] + }, + "WithdrawFromRaceParamsDTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + }, + "driverId": { + "type": "string" + } + }, + "required": [ + "raceId", + "driverId" + ] + }, + "RequestProtestDefenseCommandDTO": { + "type": "object", + "properties": { + "protestId": { + "type": "string" + }, + "stewardId": { + "type": "string" + } + }, + "required": [ + "protestId", + "stewardId" + ] + }, + "RegisterForRaceParamsDTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "driverId": { + "type": "string" + } + }, + "required": [ + "raceId", + "leagueId", + "driverId" ] }, "RacesPageDataRaceDTO": { "type": "object", "properties": { - "nullable": { + "id": { + "type": "string" + }, + "track": { + "type": "string" + }, + "car": { + "type": "string" + }, + "scheduledAt": { + "type": "string" + }, + "status": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "leagueName": { "type": "string" } }, "required": [ - "nullable" - ] - }, - "RacesPageDataDTO": { - "type": "object", - "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[RacesPageDataRaceDto] })\n races!: RacesPageDataRaceDto" - } - } - }, - "required": [ - "type" + "id", + "track", + "car", + "scheduledAt", + "status", + "leagueId", + "leagueName" ] }, "RaceWithSOFDTO": { "type": "object", "properties": { - "nullable": { + "id": { + "type": "string" + }, + "track": { "type": "string" } }, "required": [ - "nullable" + "id", + "track" + ] + }, + "RaceStatsDTO": { + "type": "object", + "properties": { + "totalRaces": { + "type": "number" + } + }, + "required": [ + "totalRaces" ] }, "RaceResultsDetailDTO": { "type": "object", "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[RaceResultDto] })\n results!: RaceResultDto" - } + "raceId": { + "type": "string" + }, + "track": { + "type": "string" } }, "required": [ - "type" + "raceId", + "track" ] }, - "RaceProtestsDTO": { + "RaceResultDTO": { "type": "object", "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[RaceProtestDto] })\n protests!: RaceProtestDto" - } + "driverId": { + "type": "string" + }, + "driverName": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + }, + "position": { + "type": "number" + }, + "startPosition": { + "type": "number" + }, + "incidents": { + "type": "number" + }, + "fastestLap": { + "type": "number" + }, + "positionChange": { + "type": "number" + }, + "isPodium": { + "type": "boolean" + }, + "isClean": { + "type": "boolean" } }, "required": [ - "type" + "driverId", + "driverName", + "avatarUrl", + "position", + "startPosition", + "incidents", + "fastestLap", + "positionChange", + "isPodium", + "isClean" ] }, "RaceProtestDTO": { "type": "object", "properties": { + "id": { + "type": "string" + }, + "protestingDriverId": { + "type": "string" + }, + "accusedDriverId": { + "type": "string" + }, + "incident": { + "type": "object" + }, "lap": { "type": "number" }, @@ -448,6 +558,10 @@ } }, "required": [ + "id", + "protestingDriverId", + "accusedDriverId", + "incident", "lap", "description" ] @@ -455,60 +569,138 @@ "RacePenaltyDTO": { "type": "object", "properties": { - "notes": { + "id": { "type": "string" }, - "nullable": { + "driverId": { + "type": "string" + }, + "type": { + "type": "string" + }, + "value": { + "type": "number" + }, + "reason": { + "type": "string" + }, + "issuedBy": { + "type": "string" + }, + "issuedAt": { "type": "string" } }, "required": [ - "nullable" - ] - }, - "RacePenaltiesDTO": { - "type": "object", - "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[RacePenaltyDTO] })\n penalties!: RacePenaltyDTO" - } - } - }, - "required": [ - "type" + "id", + "driverId", + "type", + "value", + "reason", + "issuedBy", + "issuedAt" ] }, "RaceDetailUserResultDTO": { "type": "object", "properties": { - "nullable": { - "type": "string" + "position": { + "type": "number" + }, + "startPosition": { + "type": "number" + }, + "incidents": { + "type": "number" + }, + "fastestLap": { + "type": "number" + }, + "positionChange": { + "type": "number" + }, + "isPodium": { + "type": "boolean" + }, + "isClean": { + "type": "boolean" } }, "required": [ - "nullable" + "position", + "startPosition", + "incidents", + "fastestLap", + "positionChange", + "isPodium", + "isClean" + ] + }, + "RaceDetailRegistrationDTO": { + "type": "object", + "properties": { + "isUserRegistered": { + "type": "boolean" + }, + "canRegister": { + "type": "boolean" + } + }, + "required": [ + "isUserRegistered", + "canRegister" ] }, "RaceDetailRaceDTO": { "type": "object", "properties": { - "nullable": { + "id": { "type": "string" }, - "required": { + "leagueId": { + "type": "string" + }, + "track": { + "type": "string" + }, + "car": { + "type": "string" + }, + "scheduledAt": { + "type": "string" + }, + "sessionType": { + "type": "string" + }, + "status": { "type": "string" } }, "required": [ - "nullable", - "required" + "id", + "leagueId", + "track", + "car", + "scheduledAt", + "sessionType", + "status" ] }, "RaceDetailLeagueDTO": { "type": "object", "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "settings": { + "type": "object" + }, "maxDrivers": { "type": "number" }, @@ -517,95 +709,129 @@ } }, "required": [ - "maxDrivers", - "qualifyingFormat" + "id", + "name", + "description", + "settings" ] }, "RaceDetailEntryDTO": { "type": "object", "properties": { - "nullable": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "country": { + "type": "string" + }, + "avatarUrl": { "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" + "id", + "name", + "country", + "avatarUrl" ] }, "RaceDTO": { "type": "object", "properties": { - "leagueName": { + "id": { "type": "string" }, - "nullable": { + "name": { + "type": "string" + }, + "date": { "type": "string" } }, "required": [ - "nullable" + "id", + "name", + "date" + ] + }, + "RaceActionParamsDTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + } + }, + "required": [ + "raceId" ] }, "QuickPenaltyCommandDTO": { "type": "object", "properties": { - "enum": { + "raceId": { "type": "string" }, - "required": { + "driverId": { + "type": "string" + }, + "adminId": { "type": "string" } }, "required": [ - "enum", - "required" + "raceId", + "driverId", + "adminId" ] }, - "ImportRaceResultsSummaryDTO": { + "ImportRaceResultsDTO": { "type": "object", "properties": { - "errors": { - "type": "array", - "items": { - "type": "string" - } + "raceId": { + "type": "string" }, - "type": { - "type": "array", - "items": { - "type": "string" - } + "resultsFileContent": { + "type": "string" } }, "required": [ - "type" + "raceId", + "resultsFileContent" + ] + }, + "GetRaceDetailParamsDTODTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + }, + "driverId": { + "type": "string" + } + }, + "required": [ + "raceId", + "driverId" ] }, "FileProtestCommandDTO": { "type": "object", "properties": { + "raceId": { + "type": "string" + }, + "protestingDriverId": { + "type": "string" + }, + "accusedDriverId": { + "type": "string" + }, + "incident": { + "type": "object" + }, "lap": { "type": "number" }, @@ -614,135 +840,192 @@ }, "timeInRace": { "type": "number" - }, - "required": { - "type": "string" } }, "required": [ + "raceId", + "protestingDriverId", + "accusedDriverId", + "incident", "lap", - "description", - "timeInRace", - "required" + "description" + ] + }, + "DashboardRecentResultDTO": { + "type": "object", + "properties": { + "raceId": { + "type": "string" + }, + "raceName": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "leagueName": { + "type": "string" + }, + "finishedAt": { + "type": "string" + }, + "position": { + "type": "number" + }, + "incidents": { + "type": "number" + } + }, + "required": [ + "raceId", + "raceName", + "leagueId", + "leagueName", + "finishedAt", + "position", + "incidents" ] }, "DashboardRaceSummaryDTO": { "type": "object", "properties": { - "enum": { + "id": { + "type": "string" + }, + "leagueId": { + "type": "string" + }, + "leagueName": { + "type": "string" + }, + "track": { + "type": "string" + }, + "car": { + "type": "string" + }, + "scheduledAt": { "type": "string" } }, "required": [ - "enum" + "id", + "leagueId", + "leagueName", + "track", + "car", + "scheduledAt" ] }, - "DashboardOverviewDTO": { + "DashboardLeagueStandingSummaryDTO": { "type": "object", "properties": { - "nullable": { - "$ref": "#/components/schemas/true })\n currentDriver!: DashboardDriverSummaryDTO null" + "leagueId": { + "type": "string" }, - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[DashboardRaceSummaryDTO] })\n myUpcomingRaces!: DashboardRaceSummaryDTO" - } + "leagueName": { + "type": "string" + }, + "position": { + "type": "number" + }, + "totalDrivers": { + "type": "number" + }, + "points": { + "type": "number" } }, "required": [ - "nullable", - "type" + "leagueId", + "leagueName", + "position", + "totalDrivers", + "points" + ] + }, + "DashboardFriendSummaryDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "country": { + "type": "string" + }, + "avatarUrl": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "country", + "avatarUrl" ] }, "DashboardFeedSummaryDTO": { "type": "object", "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[DashboardFeedItemSummaryDTO] })\n items!: DashboardFeedItemSummaryDTO" - } + "notificationCount": { + "type": "number" } }, "required": [ - "type" + "notificationCount" ] }, "DashboardFeedItemSummaryDTO": { "type": "object", "properties": { - "enum": { + "id": { "type": "string" }, - "required": { + "enum": { "type": "string" } }, "required": [ - "enum", - "required" + "id", + "enum" ] }, "DashboardDriverSummaryDTO": { "type": "object", "properties": { - "nullable": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "country": { + "type": "string" + }, + "avatarUrl": { "type": "string" } }, "required": [ - "nullable" + "id", + "name", + "country", + "avatarUrl" ] }, "ApplyPenaltyCommandDTO": { "type": "object", "properties": { - "enum": { + "raceId": { "type": "string" }, - "required": { + "driverId": { "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": { + "stewardId": { "type": "string" }, "enum": { @@ -750,1149 +1033,12 @@ } }, "required": [ - "paymentId", + "raceId", + "driverId", + "stewardId", "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": { @@ -1912,161 +1058,6 @@ "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": { @@ -2089,16 +1080,12 @@ }, "targetDriverId": { "type": "string" - }, - "enum": { - "type": "string" } }, "required": [ "leagueId", "performerDriverId", - "targetDriverId", - "enum" + "targetDriverId" ] }, "SeasonDTO": { @@ -2112,24 +1099,12 @@ }, "leagueId": { "type": "string" - }, - "required": { - "type": "string" - }, - "enum": { - "type": "string" - }, - "isPrimary": { - "type": "boolean" } }, "required": [ "seasonId", "name", - "leagueId", - "required", - "enum", - "isPrimary" + "leagueId" ] }, "RemoveLeagueMemberOutputDTO": { @@ -2167,14 +1142,10 @@ "properties": { "success": { "type": "boolean" - }, - "required": { - "type": "string" } }, "required": [ - "success", - "required" + "success" ] }, "RejectJoinRequestInputDTO": { @@ -2195,8 +1166,8 @@ "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" + "id": { + "type": "string" }, "raceId": { "type": "string" @@ -2213,19 +1184,15 @@ }, "description": { "type": "string" - }, - "enum": { - "type": "string" } }, "required": [ - "TODO", + "id", "raceId", "protestingDriverId", "accusedDriverId", "submittedAt", - "description", - "enum" + "description" ] }, "LeagueWithCapacityDTO": { @@ -2236,39 +1203,11 @@ }, "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" + "name" ] }, "LeagueSummaryDTO": { @@ -2279,31 +1218,11 @@ }, "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" + "name" ] }, "LeagueStatsDTO": { @@ -2325,52 +1244,15 @@ "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" + "driverId" ] }, "LeagueSeasonSummaryDTO": { @@ -2384,67 +1266,12 @@ }, "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" + "status" ] }, "LeagueMemberDTO": { @@ -2452,23 +1279,10 @@ "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" + "driverId" ] }, "LeagueJoinRequestDTO": { @@ -2486,21 +1300,13 @@ "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" + "requestedAt" ] }, "LeagueConfigFormModelTimingsDTO": { @@ -2533,49 +1339,6 @@ "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": { @@ -2591,34 +1354,15 @@ "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" + "leagueId" ] }, "LeagueConfigFormModelBasicsDTO": { @@ -2629,29 +1373,11 @@ }, "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" + "description" ] }, "LeagueAdminPermissionsDTO": { @@ -2669,31 +1395,6 @@ "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": { @@ -2768,17 +1469,6 @@ "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": { @@ -2802,19 +1492,11 @@ }, "description": { "type": "string" - }, - "enum": { - "type": "string" - }, - "ownerId": { - "type": "string" } }, "required": [ "name", - "description", - "enum", - "ownerId" + "description" ] }, "ApproveJoinRequestOutputDTO": { @@ -2822,14 +1504,10 @@ "properties": { "success": { "type": "boolean" - }, - "required": { - "type": "string" } }, "required": [ - "success", - "required" + "success" ] }, "ApproveJoinRequestInputDTO": { @@ -2847,116 +1525,190 @@ "leagueId" ] }, - "AllLeaguesWithCapacityDTO": { + "GetDriverRegistrationStatusQueryDTO": { "type": "object", "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[LeagueWithCapacityDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueWithCapacityDTO)\n leagues: LeagueWithCapacityDTO" - } + "raceId": { + "type": "string" }, - "totalCount": { - "type": "number" + "driverId": { + "type": "string" } }, "required": [ - "type", - "totalCount" + "raceId", + "driverId" ] }, - "AllLeaguesWithCapacityAndScoringDTO": { + "DriverStatsDTO": { "type": "object", "properties": { - "type": { - "type": "array", - "items": { - "$ref": "#/components/schemas/[LeagueSummaryDTO] })\n @IsArray()\n @ValidateNested({ each: true })\n @Type(() => LeagueSummaryDTO)\n leagues: LeagueSummaryDTO" - } - }, - "totalCount": { + "totalDrivers": { "type": "number" } }, "required": [ - "type", - "totalCount" + "totalDrivers" + ] + }, + "DriverRegistrationStatusDTO": { + "type": "object", + "properties": { + "isRegistered": { + "type": "boolean" + }, + "raceId": { + "type": "string" + }, + "driverId": { + "type": "string" + } + }, + "required": [ + "isRegistered", + "raceId", + "driverId" + ] + }, + "DriverLeaderboardItemDTO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "rating": { + "type": "number" + }, + "skillLevel": { + "type": "string" + }, + "nationality": { + "type": "string" + }, + "racesCompleted": { + "type": "number" + }, + "wins": { + "type": "number" + }, + "podiums": { + "type": "number" + }, + "isActive": { + "type": "boolean" + }, + "rank": { + "type": "number" + } + }, + "required": [ + "id", + "name", + "rating", + "skillLevel", + "nationality", + "racesCompleted", + "wins", + "podiums", + "isActive", + "rank" + ] + }, + "CompleteOnboardingOutputDTO": { + "type": "object", + "properties": { + "success": { + "type": "boolean" + } + }, + "required": [ + "success" + ] + }, + "CompleteOnboardingInputDTO": { + "type": "object", + "properties": { + "firstName": { + "type": "string" + }, + "lastName": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "country": { + "type": "string" + } + }, + "required": [ + "firstName", + "lastName", + "displayName", + "country" ] }, "AuthenticatedUserDTO": { "type": "object", "properties": { - "iracingCustomerId": { + "userId": { "type": "string" }, - "primaryDriverId": { + "email": { "type": "string" }, - "avatarUrl": { - "type": "string" - }, - "returnTo": { - "type": "string" - }, - "required": { + "displayName": { "type": "string" } }, "required": [ - "required" + "userId", + "email", + "displayName" ] }, "AuthSessionDTO": { "type": "object", "properties": { - "iracingCustomerId": { + "token": { "type": "string" }, - "primaryDriverId": { - "type": "string" - }, - "avatarUrl": { - "type": "string" - }, - "returnTo": { - "type": "string" - }, - "required": { - "type": "string" + "user": { + "$ref": "#/components/schemas/AuthenticatedUserDTO" } }, "required": [ - "required" + "token", + "user" ] }, - "RecordPageViewInputDTO": { + "RecordPageViewOutputDTO": { "type": "object", "properties": { - "enum": { - "type": "string" - }, - "required": { + "pageViewId": { "type": "string" } }, "required": [ - "enum", - "required" + "pageViewId" ] }, - "RecordEngagementInputDTO": { + "RecordEngagementOutputDTO": { "type": "object", "properties": { - "enum": { + "eventId": { "type": "string" }, - "required": { - "type": "string" + "engagementWeight": { + "type": "number" } }, "required": [ - "enum", - "required" + "eventId", + "engagementWeight" ] } } diff --git a/apps/api/src/main.ts b/apps/api/src/main.ts index 737d9f0ea..7c04058d8 100644 --- a/apps/api/src/main.ts +++ b/apps/api/src/main.ts @@ -8,7 +8,7 @@ import { join } from 'path'; import { AppModule } from './app.module'; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const app = await NestFactory.create(AppModule, process.env.GENERATE_OPENAPI ? { logger: false } : undefined); // Swagger/OpenAPI configuration const config = new DocumentBuilder() @@ -35,6 +35,8 @@ async function bootstrap() { const outputPath = join(__dirname, '../openapi.json'); writeFileSync(outputPath, JSON.stringify(document, null, 2)); console.log(`✅ OpenAPI spec generated at: ${outputPath}`); + await app.close(); + process.exit(0); } await app.listen(3000); diff --git a/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts b/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts deleted file mode 100644 index da11c6ffd..000000000 --- a/apps/website/lib/types/generated/AllLeaguesWithCapacityAndScoringDTO.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 deleted file mode 100644 index 6b8ce3b5e..000000000 --- a/apps/website/lib/types/generated/AllLeaguesWithCapacityDTO.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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/ApplyPenaltyCommandDTO.ts b/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts index 38bc19775..0d03cc70f 100644 --- a/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts +++ b/apps/website/lib/types/generated/ApplyPenaltyCommandDTO.ts @@ -5,6 +5,8 @@ */ export interface ApplyPenaltyCommandDTO { + raceId: string; + driverId: string; + stewardId: string; enum: string; - required: string; } diff --git a/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts b/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts index 229b7b9bb..62b8c4141 100644 --- a/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts +++ b/apps/website/lib/types/generated/ApproveJoinRequestOutputDTO.ts @@ -6,5 +6,4 @@ 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 index 3e9cb6b61..23a329417 100644 --- a/apps/website/lib/types/generated/AuthSessionDTO.ts +++ b/apps/website/lib/types/generated/AuthSessionDTO.ts @@ -4,10 +4,9 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ +import type { AuthenticatedUserDTO } from './AuthenticatedUserDTO'; + export interface AuthSessionDTO { - iracingCustomerId?: string; - primaryDriverId?: string; - avatarUrl?: string; - returnTo?: string; - required: string; + token: string; + user: AuthenticatedUserDTO; } diff --git a/apps/website/lib/types/generated/AuthenticatedUserDTO.ts b/apps/website/lib/types/generated/AuthenticatedUserDTO.ts index 20303e860..2b486790c 100644 --- a/apps/website/lib/types/generated/AuthenticatedUserDTO.ts +++ b/apps/website/lib/types/generated/AuthenticatedUserDTO.ts @@ -5,9 +5,7 @@ */ export interface AuthenticatedUserDTO { - iracingCustomerId?: string; - primaryDriverId?: string; - avatarUrl?: string; - returnTo?: string; - required: string; + userId: string; + email: string; + displayName: string; } diff --git a/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts b/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts index a07df2da9..6014facff 100644 --- a/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts +++ b/apps/website/lib/types/generated/CompleteOnboardingInputDto.ts @@ -9,5 +9,4 @@ export interface CompleteOnboardingInputDTO { 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 index 30e88827d..54cd102cd 100644 --- a/apps/website/lib/types/generated/CompleteOnboardingOutputDTO.ts +++ b/apps/website/lib/types/generated/CompleteOnboardingOutputDTO.ts @@ -6,5 +6,4 @@ export interface CompleteOnboardingOutputDTO { success: boolean; - required: string; } diff --git a/apps/website/lib/types/generated/CreateLeagueInputDTO.ts b/apps/website/lib/types/generated/CreateLeagueInputDTO.ts index cd7d26ea5..bc0a70ae0 100644 --- a/apps/website/lib/types/generated/CreateLeagueInputDTO.ts +++ b/apps/website/lib/types/generated/CreateLeagueInputDTO.ts @@ -7,6 +7,4 @@ export interface CreateLeagueInputDTO { name: string; description: string; - enum: string; - ownerId: string; } diff --git a/apps/website/lib/types/generated/CreateSponsorInputDTO.ts b/apps/website/lib/types/generated/CreateSponsorInputDTO.ts index 46eac70b4..92dda4b90 100644 --- a/apps/website/lib/types/generated/CreateSponsorInputDTO.ts +++ b/apps/website/lib/types/generated/CreateSponsorInputDTO.ts @@ -7,5 +7,4 @@ 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 deleted file mode 100644 index 00156a7f5..000000000 --- a/apps/website/lib/types/generated/CreateSponsorOutputDTO.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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 index 65305f18b..209c0389b 100644 --- a/apps/website/lib/types/generated/DashboardDriverSummaryDTO.ts +++ b/apps/website/lib/types/generated/DashboardDriverSummaryDTO.ts @@ -5,5 +5,8 @@ */ export interface DashboardDriverSummaryDTO { - nullable: string; + id: string; + name: string; + country: string; + avatarUrl: string; } diff --git a/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts b/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts index 4c4b24c39..f35c8c7f8 100644 --- a/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts +++ b/apps/website/lib/types/generated/DashboardFeedItemSummaryDTO.ts @@ -5,6 +5,6 @@ */ export interface DashboardFeedItemSummaryDTO { + id: string; enum: string; - required: string; } diff --git a/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts b/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts index dc42b33f7..e44e2347f 100644 --- a/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts +++ b/apps/website/lib/types/generated/DashboardFeedSummaryDTO.ts @@ -5,6 +5,5 @@ */ export interface DashboardFeedSummaryDTO { - type: [DashboardFeedItemSummaryDTO] }) - items!: DashboardFeedItemSummaryDTO[]; + notificationCount: number; } diff --git a/apps/website/lib/types/generated/DriverDto.ts b/apps/website/lib/types/generated/DashboardFriendSummaryDTO.ts similarity index 69% rename from apps/website/lib/types/generated/DriverDto.ts rename to apps/website/lib/types/generated/DashboardFriendSummaryDTO.ts index 94db748ae..667289ac5 100644 --- a/apps/website/lib/types/generated/DriverDto.ts +++ b/apps/website/lib/types/generated/DashboardFriendSummaryDTO.ts @@ -4,10 +4,9 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface DriverDto { +export interface DashboardFriendSummaryDTO { id: string; name: string; - avatarUrl?: string; - iracingId?: string; - rating?: number; + country: string; + avatarUrl: string; } diff --git a/apps/website/lib/types/generated/CreatePaymentInputDTO.ts b/apps/website/lib/types/generated/DashboardLeagueStandingSummaryDTO.ts similarity index 58% rename from apps/website/lib/types/generated/CreatePaymentInputDTO.ts rename to apps/website/lib/types/generated/DashboardLeagueStandingSummaryDTO.ts index e0019fc98..8a5181e32 100644 --- a/apps/website/lib/types/generated/CreatePaymentInputDTO.ts +++ b/apps/website/lib/types/generated/DashboardLeagueStandingSummaryDTO.ts @@ -4,10 +4,10 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface CreatePaymentInputDTO { - enum: string; - amount: number; - payerId: string; +export interface DashboardLeagueStandingSummaryDTO { leagueId: string; - required: string; + leagueName: string; + position: number; + totalDrivers: number; + points: number; } diff --git a/apps/website/lib/types/generated/DashboardOverviewDTO.ts b/apps/website/lib/types/generated/DashboardOverviewDTO.ts deleted file mode 100644 index 19cdc01f5..000000000 --- a/apps/website/lib/types/generated/DashboardOverviewDTO.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * 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 index 35479b8b9..33531f5ad 100644 --- a/apps/website/lib/types/generated/DashboardRaceSummaryDTO.ts +++ b/apps/website/lib/types/generated/DashboardRaceSummaryDTO.ts @@ -5,5 +5,10 @@ */ export interface DashboardRaceSummaryDTO { - enum: string; + id: string; + leagueId: string; + leagueName: string; + track: string; + car: string; + scheduledAt: string; } diff --git a/apps/website/lib/types/generated/DashboardRecentResultDTO.ts b/apps/website/lib/types/generated/DashboardRecentResultDTO.ts new file mode 100644 index 000000000..b389ffdcd --- /dev/null +++ b/apps/website/lib/types/generated/DashboardRecentResultDTO.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 DashboardRecentResultDTO { + raceId: string; + raceName: string; + leagueId: string; + leagueName: string; + finishedAt: string; + position: number; + incidents: number; +} diff --git a/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts b/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts index a6fbadbe8..577f59cac 100644 --- a/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts +++ b/apps/website/lib/types/generated/DriverLeaderboardItemDTO.ts @@ -15,6 +15,4 @@ export interface DriverLeaderboardItemDTO { podiums: number; isActive: boolean; rank: number; - avatarUrl?: string; - nullable: string; } diff --git a/apps/website/lib/types/generated/CreatePaymentOutputDTO.ts b/apps/website/lib/types/generated/DriverRegistrationStatusDTO.ts similarity index 61% rename from apps/website/lib/types/generated/CreatePaymentOutputDTO.ts rename to apps/website/lib/types/generated/DriverRegistrationStatusDTO.ts index a036326b4..7f7c03568 100644 --- a/apps/website/lib/types/generated/CreatePaymentOutputDTO.ts +++ b/apps/website/lib/types/generated/DriverRegistrationStatusDTO.ts @@ -4,8 +4,8 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface CreatePaymentOutputDTO { - payment: PaymentDTO; - type: PaymentDTO }) - payment: PaymentDTO; +export interface DriverRegistrationStatusDTO { + isRegistered: boolean; + raceId: string; + driverId: string; } diff --git a/apps/website/lib/types/generated/DriversLeaderboardDTO.ts b/apps/website/lib/types/generated/DriversLeaderboardDTO.ts deleted file mode 100644 index 2291c93a8..000000000 --- a/apps/website/lib/types/generated/DriversLeaderboardDTO.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** - * 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 index 602269ba8..975e16fff 100644 --- a/apps/website/lib/types/generated/FileProtestCommandDTO.ts +++ b/apps/website/lib/types/generated/FileProtestCommandDTO.ts @@ -5,8 +5,11 @@ */ export interface FileProtestCommandDTO { + raceId: string; + protestingDriverId: string; + accusedDriverId: string; + incident: Record; lap: number; description: string; - timeInRace: number; - required: string; + timeInRace?: number; } diff --git a/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts b/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts deleted file mode 100644 index 4920613c3..000000000 --- a/apps/website/lib/types/generated/GetEntitySponsorshipPricingResultDTO.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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 deleted file mode 100644 index 35a2e26ff..000000000 --- a/apps/website/lib/types/generated/GetLeagueAdminConfigOutputDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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/RecordEngagementInputDTO.ts b/apps/website/lib/types/generated/GetRaceDetailParamsDTODTO.ts similarity index 68% rename from apps/website/lib/types/generated/RecordEngagementInputDTO.ts rename to apps/website/lib/types/generated/GetRaceDetailParamsDTODTO.ts index 6627265c3..718452ac7 100644 --- a/apps/website/lib/types/generated/RecordEngagementInputDTO.ts +++ b/apps/website/lib/types/generated/GetRaceDetailParamsDTODTO.ts @@ -4,7 +4,7 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface RecordEngagementInputDTO { - enum: string; - required: string; +export interface GetRaceDetailParamsDTODTO { + raceId: string; + driverId: string; } diff --git a/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts b/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts deleted file mode 100644 index f46f5597b..000000000 --- a/apps/website/lib/types/generated/GetSponsorsOutputDTO.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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/ImportRaceResultsDTO.ts similarity index 66% rename from apps/website/lib/types/generated/ImportRaceResultsSummaryDTO.ts rename to apps/website/lib/types/generated/ImportRaceResultsDTO.ts index 6d467e636..71415e40f 100644 --- a/apps/website/lib/types/generated/ImportRaceResultsSummaryDTO.ts +++ b/apps/website/lib/types/generated/ImportRaceResultsDTO.ts @@ -4,7 +4,7 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface ImportRaceResultsSummaryDTO { - errors?: string[]; - type: string[]; +export interface ImportRaceResultsDTO { + raceId: string; + resultsFileContent: string; } diff --git a/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts b/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts deleted file mode 100644 index 5b2922029..000000000 --- a/apps/website/lib/types/generated/LeagueAdminConfigDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 deleted file mode 100644 index a14d4e1aa..000000000 --- a/apps/website/lib/types/generated/LeagueAdminDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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/LeagueAdminProtestsDTO.ts b/apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts deleted file mode 100644 index 4bc3fb25c..000000000 --- a/apps/website/lib/types/generated/LeagueAdminProtestsDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 index 773e97cdb..5130aef67 100644 --- a/apps/website/lib/types/generated/LeagueConfigFormModelBasicsDTO.ts +++ b/apps/website/lib/types/generated/LeagueConfigFormModelBasicsDTO.ts @@ -7,5 +7,4 @@ 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 index 0ffc06eef..74e172f74 100644 --- a/apps/website/lib/types/generated/LeagueConfigFormModelDTO.ts +++ b/apps/website/lib/types/generated/LeagueConfigFormModelDTO.ts @@ -6,8 +6,4 @@ export interface LeagueConfigFormModelDTO { leagueId: string; - type: LeagueConfigFormModelBasicsDTO }) - @ValidateNested() - @Type(() => LeagueConfigFormModelBasicsDTO) - basics: LeagueConfigFormModelBasicsDTO; } diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts b/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts deleted file mode 100644 index 0cb46880f..000000000 --- a/apps/website/lib/types/generated/LeagueConfigFormModelStewardingDTO.ts +++ /dev/null @@ -1,17 +0,0 @@ -/** - * 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/LeagueJoinRequestDTO.ts b/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts index 2626a8bc3..26b48dac4 100644 --- a/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts +++ b/apps/website/lib/types/generated/LeagueJoinRequestDTO.ts @@ -8,11 +8,6 @@ export interface LeagueJoinRequestDTO { id: string; leagueId: string; driverId: string; + /** Format: date-time */ 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 index 0f6c89ff0..8e188751b 100644 --- a/apps/website/lib/types/generated/LeagueMemberDTO.ts +++ b/apps/website/lib/types/generated/LeagueMemberDTO.ts @@ -6,10 +6,4 @@ 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 deleted file mode 100644 index 27d39dbe3..000000000 --- a/apps/website/lib/types/generated/LeagueMembershipsDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 deleted file mode 100644 index be1840e52..000000000 --- a/apps/website/lib/types/generated/LeagueOwnerSummaryDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 deleted file mode 100644 index d0302cedf..000000000 --- a/apps/website/lib/types/generated/LeagueScheduleDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 index e66278ab0..6d8d727d5 100644 --- a/apps/website/lib/types/generated/LeagueSeasonSummaryDTO.ts +++ b/apps/website/lib/types/generated/LeagueSeasonSummaryDTO.ts @@ -8,7 +8,4 @@ export interface LeagueSeasonSummaryDTO { seasonId: string; name: string; status: string; - required: string; - isPrimary: boolean; - isParallelActive: boolean; } diff --git a/apps/website/lib/types/generated/LeagueStandingDTO.ts b/apps/website/lib/types/generated/LeagueStandingDTO.ts index 7743c1c73..ff899a055 100644 --- a/apps/website/lib/types/generated/LeagueStandingDTO.ts +++ b/apps/website/lib/types/generated/LeagueStandingDTO.ts @@ -6,10 +6,4 @@ 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 deleted file mode 100644 index acf719451..000000000 --- a/apps/website/lib/types/generated/LeagueStandingsDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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/LeagueSummaryDTO.ts b/apps/website/lib/types/generated/LeagueSummaryDTO.ts index 6abc38d22..f0f406386 100644 --- a/apps/website/lib/types/generated/LeagueSummaryDTO.ts +++ b/apps/website/lib/types/generated/LeagueSummaryDTO.ts @@ -7,9 +7,4 @@ 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 index cf040339d..332da08a5 100644 --- a/apps/website/lib/types/generated/LeagueWithCapacityDTO.ts +++ b/apps/website/lib/types/generated/LeagueWithCapacityDTO.ts @@ -7,14 +7,4 @@ 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 index e657989a0..c8e0c469e 100644 --- a/apps/website/lib/types/generated/MemberPaymentDto.ts +++ b/apps/website/lib/types/generated/MemberPaymentDto.ts @@ -5,42 +5,10 @@ */ export interface MemberPaymentDto { - payment: MemberPaymentDto; - fee: MembershipFeeDto; - payments: PaymentDto[]; - prizes: PrizeDto[]; - prize: PrizeDto; - wallet: WalletDto; - transactions: TransactionDto[]; - transaction: TransactionDto; id: string; - enum: string; + feeId: string; + driverId: 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 index 904385b4d..172e04e41 100644 --- a/apps/website/lib/types/generated/MembershipFeeDto.ts +++ b/apps/website/lib/types/generated/MembershipFeeDto.ts @@ -5,42 +5,6 @@ */ 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 index e43245ff3..9411f058c 100644 --- a/apps/website/lib/types/generated/PaymentDto.ts +++ b/apps/website/lib/types/generated/PaymentDto.ts @@ -6,12 +6,4 @@ 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 index f7fb48180..809aaec1d 100644 --- a/apps/website/lib/types/generated/PrizeDto.ts +++ b/apps/website/lib/types/generated/PrizeDto.ts @@ -5,42 +5,10 @@ */ 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; + amount: number; } diff --git a/apps/website/lib/types/generated/ProtestDTO.ts b/apps/website/lib/types/generated/ProtestDTO.ts index 59ffe94d2..a83b9850f 100644 --- a/apps/website/lib/types/generated/ProtestDTO.ts +++ b/apps/website/lib/types/generated/ProtestDTO.ts @@ -5,16 +5,11 @@ */ 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; + /** Format: date-time */ submittedAt: string; description: string; - enum: string; } diff --git a/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts b/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts index 6bf3cb1b2..c6854d268 100644 --- a/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts +++ b/apps/website/lib/types/generated/QuickPenaltyCommandDTO.ts @@ -5,6 +5,7 @@ */ export interface QuickPenaltyCommandDTO { - enum: string; - required: string; + raceId: string; + driverId: string; + adminId: string; } diff --git a/apps/website/lib/types/generated/LeagueSettingsDTO.ts b/apps/website/lib/types/generated/RaceActionParamsDTO.ts similarity index 75% rename from apps/website/lib/types/generated/LeagueSettingsDTO.ts rename to apps/website/lib/types/generated/RaceActionParamsDTO.ts index 416e02251..811eb7462 100644 --- a/apps/website/lib/types/generated/LeagueSettingsDTO.ts +++ b/apps/website/lib/types/generated/RaceActionParamsDTO.ts @@ -4,6 +4,6 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface LeagueSettingsDTO { - nullable: string; +export interface RaceActionParamsDTO { + raceId: string; } diff --git a/apps/website/lib/types/generated/RaceDTO.ts b/apps/website/lib/types/generated/RaceDTO.ts index c071d6a42..b42e52a4f 100644 --- a/apps/website/lib/types/generated/RaceDTO.ts +++ b/apps/website/lib/types/generated/RaceDTO.ts @@ -5,6 +5,7 @@ */ export interface RaceDTO { - leagueName?: string; - nullable: string; + id: string; + name: string; + date: string; } diff --git a/apps/website/lib/types/generated/RaceDetailDTO.ts b/apps/website/lib/types/generated/RaceDetailDTO.ts deleted file mode 100644 index 0577c426c..000000000 --- a/apps/website/lib/types/generated/RaceDetailDTO.ts +++ /dev/null @@ -1,13 +0,0 @@ -/** - * 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 index 974643172..8fe316462 100644 --- a/apps/website/lib/types/generated/RaceDetailEntryDTO.ts +++ b/apps/website/lib/types/generated/RaceDetailEntryDTO.ts @@ -5,5 +5,8 @@ */ export interface RaceDetailEntryDTO { - nullable: string; + id: string; + name: string; + country: string; + avatarUrl: string; } diff --git a/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts b/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts index 349027d31..d9ac8645a 100644 --- a/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts +++ b/apps/website/lib/types/generated/RaceDetailLeagueDTO.ts @@ -5,6 +5,10 @@ */ export interface RaceDetailLeagueDTO { - maxDrivers: number; - qualifyingFormat: string; + id: string; + name: string; + description: string; + settings: Record; + maxDrivers?: number; + qualifyingFormat?: string; } diff --git a/apps/website/lib/types/generated/RaceDetailRaceDTO.ts b/apps/website/lib/types/generated/RaceDetailRaceDTO.ts index 04a9184ed..6149faab8 100644 --- a/apps/website/lib/types/generated/RaceDetailRaceDTO.ts +++ b/apps/website/lib/types/generated/RaceDetailRaceDTO.ts @@ -5,6 +5,11 @@ */ export interface RaceDetailRaceDTO { - nullable: string; - required: string; + id: string; + leagueId: string; + track: string; + car: string; + scheduledAt: string; + sessionType: string; + status: string; } diff --git a/apps/website/lib/types/generated/RaceDetailRegistrationDTO.ts b/apps/website/lib/types/generated/RaceDetailRegistrationDTO.ts new file mode 100644 index 000000000..7667e004d --- /dev/null +++ b/apps/website/lib/types/generated/RaceDetailRegistrationDTO.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 RaceDetailRegistrationDTO { + isUserRegistered: boolean; + canRegister: boolean; +} diff --git a/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts b/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts index 86e6468ae..4bea3b5f1 100644 --- a/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts +++ b/apps/website/lib/types/generated/RaceDetailUserResultDTO.ts @@ -5,5 +5,11 @@ */ export interface RaceDetailUserResultDTO { - nullable: string; + position: number; + startPosition: number; + incidents: number; + fastestLap: number; + positionChange: number; + isPodium: boolean; + isClean: boolean; } diff --git a/apps/website/lib/types/generated/RacePenaltiesDTO.ts b/apps/website/lib/types/generated/RacePenaltiesDTO.ts deleted file mode 100644 index 15ba432f9..000000000 --- a/apps/website/lib/types/generated/RacePenaltiesDTO.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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 index 0f5b69d31..60d8785a6 100644 --- a/apps/website/lib/types/generated/RacePenaltyDTO.ts +++ b/apps/website/lib/types/generated/RacePenaltyDTO.ts @@ -5,6 +5,11 @@ */ export interface RacePenaltyDTO { - notes?: string; - nullable: string; + id: string; + driverId: string; + type: string; + value: number; + reason: string; + issuedBy: string; + issuedAt: string; } diff --git a/apps/website/lib/types/generated/RaceProtestDTO.ts b/apps/website/lib/types/generated/RaceProtestDTO.ts index 3129b0b81..f6dbaf547 100644 --- a/apps/website/lib/types/generated/RaceProtestDTO.ts +++ b/apps/website/lib/types/generated/RaceProtestDTO.ts @@ -5,6 +5,10 @@ */ export interface RaceProtestDTO { + id: string; + protestingDriverId: string; + accusedDriverId: string; + incident: Record; lap: number; description: string; } diff --git a/apps/website/lib/types/generated/RaceProtestsDTO.ts b/apps/website/lib/types/generated/RaceProtestsDTO.ts deleted file mode 100644 index d703c841d..000000000 --- a/apps/website/lib/types/generated/RaceProtestsDTO.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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/RaceResultDTO.ts b/apps/website/lib/types/generated/RaceResultDTO.ts new file mode 100644 index 000000000..ec35ece55 --- /dev/null +++ b/apps/website/lib/types/generated/RaceResultDTO.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 RaceResultDTO { + driverId: string; + driverName: string; + avatarUrl: string; + position: number; + startPosition: number; + incidents: number; + fastestLap: number; + positionChange: number; + isPodium: boolean; + isClean: boolean; +} diff --git a/apps/website/lib/types/generated/RaceResultsDetailDTO.ts b/apps/website/lib/types/generated/RaceResultsDetailDTO.ts index eb165aa53..14e11aa76 100644 --- a/apps/website/lib/types/generated/RaceResultsDetailDTO.ts +++ b/apps/website/lib/types/generated/RaceResultsDetailDTO.ts @@ -5,6 +5,6 @@ */ export interface RaceResultsDetailDTO { - type: [RaceResultDto] }) - results!: RaceResultDto[]; + raceId: string; + track: string; } diff --git a/apps/website/lib/types/generated/AllRacesPageDTO.ts b/apps/website/lib/types/generated/RaceStatsDTO.ts similarity index 76% rename from apps/website/lib/types/generated/AllRacesPageDTO.ts rename to apps/website/lib/types/generated/RaceStatsDTO.ts index d05441188..7806ec855 100644 --- a/apps/website/lib/types/generated/AllRacesPageDTO.ts +++ b/apps/website/lib/types/generated/RaceStatsDTO.ts @@ -4,6 +4,6 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface AllRacesPageDTO { - type: string[]; +export interface RaceStatsDTO { + totalRaces: number; } diff --git a/apps/website/lib/types/generated/RaceWithSOFDTO.ts b/apps/website/lib/types/generated/RaceWithSOFDTO.ts index 1bfbd0885..ad83b47b2 100644 --- a/apps/website/lib/types/generated/RaceWithSOFDTO.ts +++ b/apps/website/lib/types/generated/RaceWithSOFDTO.ts @@ -5,5 +5,6 @@ */ export interface RaceWithSOFDTO { - nullable: string; + id: string; + track: string; } diff --git a/apps/website/lib/types/generated/RacesPageDataDTO.ts b/apps/website/lib/types/generated/RacesPageDataDTO.ts deleted file mode 100644 index 0ac3a97c8..000000000 --- a/apps/website/lib/types/generated/RacesPageDataDTO.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * 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 index a72635ecc..9248cc5a9 100644 --- a/apps/website/lib/types/generated/RacesPageDataRaceDTO.ts +++ b/apps/website/lib/types/generated/RacesPageDataRaceDTO.ts @@ -5,5 +5,11 @@ */ export interface RacesPageDataRaceDTO { - nullable: string; + id: string; + track: string; + car: string; + scheduledAt: string; + status: string; + leagueId: string; + leagueName: string; } diff --git a/apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts b/apps/website/lib/types/generated/RecordEngagementOutputDTO.ts similarity index 65% rename from apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts rename to apps/website/lib/types/generated/RecordEngagementOutputDTO.ts index bcfd7fe08..4d1f03dec 100644 --- a/apps/website/lib/types/generated/LeagueConfigFormModelDropPolicyDTO.ts +++ b/apps/website/lib/types/generated/RecordEngagementOutputDTO.ts @@ -4,7 +4,7 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface LeagueConfigFormModelDropPolicyDTO { - enum: string; - required: string; +export interface RecordEngagementOutputDTO { + eventId: string; + engagementWeight: number; } diff --git a/apps/website/lib/types/generated/RecordPageViewInputDTO.ts b/apps/website/lib/types/generated/RecordPageViewOutputDTO.ts similarity index 69% rename from apps/website/lib/types/generated/RecordPageViewInputDTO.ts rename to apps/website/lib/types/generated/RecordPageViewOutputDTO.ts index be7af52f7..a8dd96d34 100644 --- a/apps/website/lib/types/generated/RecordPageViewInputDTO.ts +++ b/apps/website/lib/types/generated/RecordPageViewOutputDTO.ts @@ -4,7 +4,6 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface RecordPageViewInputDTO { - enum: string; - required: string; +export interface RecordPageViewOutputDTO { + pageViewId: string; } diff --git a/apps/website/lib/types/generated/RegisterForRaceParamsDTO.ts b/apps/website/lib/types/generated/RegisterForRaceParamsDTO.ts new file mode 100644 index 000000000..963afa237 --- /dev/null +++ b/apps/website/lib/types/generated/RegisterForRaceParamsDTO.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 RegisterForRaceParamsDTO { + raceId: string; + leagueId: string; + driverId: string; +} diff --git a/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts b/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts index bea375ede..82b09bff7 100644 --- a/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts +++ b/apps/website/lib/types/generated/RejectJoinRequestOutputDTO.ts @@ -6,5 +6,4 @@ export interface RejectJoinRequestOutputDTO { success: boolean; - required: string; } diff --git a/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts b/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts deleted file mode 100644 index a304ff6d0..000000000 --- a/apps/website/lib/types/generated/RequestAvatarGenerationOutputDTO.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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/RequestProtestDefenseCommandDTO.ts b/apps/website/lib/types/generated/RequestProtestDefenseCommandDTO.ts new file mode 100644 index 000000000..3950c00ac --- /dev/null +++ b/apps/website/lib/types/generated/RequestProtestDefenseCommandDTO.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 RequestProtestDefenseCommandDTO { + protestId: string; + stewardId: string; +} diff --git a/apps/website/lib/types/generated/SeasonDTO.ts b/apps/website/lib/types/generated/SeasonDTO.ts index b148fd044..067313bc8 100644 --- a/apps/website/lib/types/generated/SeasonDTO.ts +++ b/apps/website/lib/types/generated/SeasonDTO.ts @@ -8,7 +8,4 @@ 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 index a25d816b0..b12b66496 100644 --- a/apps/website/lib/types/generated/SponsorDashboardDTO.ts +++ b/apps/website/lib/types/generated/SponsorDashboardDTO.ts @@ -5,11 +5,6 @@ */ 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/SponsorSponsorshipsDTO.ts b/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts index 425d70204..128ef2247 100644 --- a/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts +++ b/apps/website/lib/types/generated/SponsorSponsorshipsDTO.ts @@ -5,14 +5,6 @@ */ 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 index d89028b01..6bbbe92cf 100644 --- a/apps/website/lib/types/generated/SponsoredLeagueDTO.ts +++ b/apps/website/lib/types/generated/SponsoredLeagueDTO.ts @@ -7,8 +7,4 @@ 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 index 97b453595..d23422a60 100644 --- a/apps/website/lib/types/generated/SponsorshipDetailDTO.ts +++ b/apps/website/lib/types/generated/SponsorshipDetailDTO.ts @@ -5,20 +5,9 @@ */ 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/TeamListItemViewModel.ts b/apps/website/lib/types/generated/TeamListItemViewModel.ts deleted file mode 100644 index c2347837c..000000000 --- a/apps/website/lib/types/generated/TeamListItemViewModel.ts +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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 index 2fef047cb..42b88ab2e 100644 --- a/apps/website/lib/types/generated/TransactionDto.ts +++ b/apps/website/lib/types/generated/TransactionDto.ts @@ -5,42 +5,6 @@ */ 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 index 27485e5db..b5d05e01b 100644 --- a/apps/website/lib/types/generated/UpdateLeagueMemberRoleInputDTO.ts +++ b/apps/website/lib/types/generated/UpdateLeagueMemberRoleInputDTO.ts @@ -8,5 +8,4 @@ export interface UpdateLeagueMemberRoleInputDTO { leagueId: string; performerDriverId: string; targetDriverId: string; - enum: string; } diff --git a/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts b/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts index 7e37d3d6d..7bca8ff97 100644 --- a/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts +++ b/apps/website/lib/types/generated/UpdatePaymentStatusInputDTO.ts @@ -6,5 +6,4 @@ 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 deleted file mode 100644 index 06a44389e..000000000 --- a/apps/website/lib/types/generated/UpdatePaymentStatusOutputDTO.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * 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 index af2628998..819cb4fcf 100644 --- a/apps/website/lib/types/generated/WalletDto.ts +++ b/apps/website/lib/types/generated/WalletDto.ts @@ -5,42 +5,13 @@ */ 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; + /** Format: date-time */ + createdAt: string; currency: string; - walletId: string; - description: string; } diff --git a/apps/website/lib/types/generated/CreateDriverOutputDto.ts b/apps/website/lib/types/generated/WithdrawFromRaceParamsDTO.ts similarity index 68% rename from apps/website/lib/types/generated/CreateDriverOutputDto.ts rename to apps/website/lib/types/generated/WithdrawFromRaceParamsDTO.ts index 3a938b3be..eb34f70c1 100644 --- a/apps/website/lib/types/generated/CreateDriverOutputDto.ts +++ b/apps/website/lib/types/generated/WithdrawFromRaceParamsDTO.ts @@ -4,7 +4,7 @@ * Do not edit manually - regenerate using: npm run api:sync-types */ -export interface CreateDriverOutputDto { - success?: boolean; - driverId?: string; +export interface WithdrawFromRaceParamsDTO { + raceId: string; + driverId: string; } diff --git a/apps/website/lib/types/generated/api.ts b/apps/website/lib/types/generated/api.ts new file mode 100644 index 000000000..af5845dfa --- /dev/null +++ b/apps/website/lib/types/generated/api.ts @@ -0,0 +1,469 @@ +/** + * This file was auto-generated by openapi-typescript. + * Do not make direct changes to the file. + */ + +export type paths = Record; +export type webhooks = Record; +export interface components { + schemas: { + SponsorshipPricingItemDTO: { + id: string; + level: string; + price: number; + currency: string; + }; + SponsorshipDetailDTO: { + id: string; + leagueId: string; + leagueName: string; + seasonId: string; + seasonName: string; + }; + SponsoredLeagueDTO: { + id: string; + name: string; + }; + SponsorSponsorshipsDTO: { + sponsorId: string; + sponsorName: string; + }; + SponsorDashboardMetricsDTO: { + impressions: number; + impressionsChange: number; + uniqueViewers: number; + viewersChange: number; + races: number; + drivers: number; + exposure: number; + exposureChange: number; + }; + SponsorDashboardInvestmentDTO: { + activeSponsorships: number; + totalInvestment: number; + costPerThousandViews: number; + }; + SponsorDashboardDTO: { + sponsorId: string; + sponsorName: string; + }; + GetSponsorSponsorshipsQueryParamsDTO: { + sponsorId: string; + }; + GetSponsorDashboardQueryParamsDTO: { + sponsorId: string; + }; + CreateSponsorInputDTO: { + name: string; + contactEmail: string; + }; + UpdatePaymentStatusInputDTO: { + paymentId: string; + }; + PaymentDto: { + id: string; + }; + MembershipFeeDto: { + id: string; + leagueId: string; + }; + MemberPaymentDto: { + id: string; + feeId: string; + driverId: string; + amount: number; + platformFee: number; + netAmount: number; + }; + PrizeDto: { + id: string; + leagueId: string; + seasonId: string; + position: number; + name: string; + amount: number; + }; + WalletDto: { + id: string; + leagueId: string; + balance: number; + totalRevenue: number; + totalPlatformFees: number; + totalWithdrawn: number; + /** Format: date-time */ + createdAt: string; + currency: string; + }; + TransactionDto: { + id: string; + walletId: string; + }; + PaymentDTO: { + id: string; + }; + WithdrawFromRaceParamsDTO: { + raceId: string; + driverId: string; + }; + RequestProtestDefenseCommandDTO: { + protestId: string; + stewardId: string; + }; + RegisterForRaceParamsDTO: { + raceId: string; + leagueId: string; + driverId: string; + }; + RacesPageDataRaceDTO: { + id: string; + track: string; + car: string; + scheduledAt: string; + status: string; + leagueId: string; + leagueName: string; + }; + RaceWithSOFDTO: { + id: string; + track: string; + }; + RaceStatsDTO: { + totalRaces: number; + }; + RaceResultsDetailDTO: { + raceId: string; + track: string; + }; + RaceResultDTO: { + driverId: string; + driverName: string; + avatarUrl: string; + position: number; + startPosition: number; + incidents: number; + fastestLap: number; + positionChange: number; + isPodium: boolean; + isClean: boolean; + }; + RaceProtestDTO: { + id: string; + protestingDriverId: string; + accusedDriverId: string; + incident: Record; + lap: number; + description: string; + }; + RacePenaltyDTO: { + id: string; + driverId: string; + type: string; + value: number; + reason: string; + issuedBy: string; + issuedAt: string; + }; + RaceDetailUserResultDTO: { + position: number; + startPosition: number; + incidents: number; + fastestLap: number; + positionChange: number; + isPodium: boolean; + isClean: boolean; + }; + RaceDetailRegistrationDTO: { + isUserRegistered: boolean; + canRegister: boolean; + }; + RaceDetailRaceDTO: { + id: string; + leagueId: string; + track: string; + car: string; + scheduledAt: string; + sessionType: string; + status: string; + }; + RaceDetailLeagueDTO: { + id: string; + name: string; + description: string; + settings: Record; + maxDrivers?: number; + qualifyingFormat?: string; + }; + RaceDetailEntryDTO: { + id: string; + name: string; + country: string; + avatarUrl: string; + }; + RaceDTO: { + id: string; + name: string; + date: string; + }; + RaceActionParamsDTO: { + raceId: string; + }; + QuickPenaltyCommandDTO: { + raceId: string; + driverId: string; + adminId: string; + }; + ImportRaceResultsDTO: { + raceId: string; + resultsFileContent: string; + }; + GetRaceDetailParamsDTODTO: { + raceId: string; + driverId: string; + }; + FileProtestCommandDTO: { + raceId: string; + protestingDriverId: string; + accusedDriverId: string; + incident: Record; + lap: number; + description: string; + timeInRace?: number; + }; + DashboardRecentResultDTO: { + raceId: string; + raceName: string; + leagueId: string; + leagueName: string; + finishedAt: string; + position: number; + incidents: number; + }; + DashboardRaceSummaryDTO: { + id: string; + leagueId: string; + leagueName: string; + track: string; + car: string; + scheduledAt: string; + }; + DashboardLeagueStandingSummaryDTO: { + leagueId: string; + leagueName: string; + position: number; + totalDrivers: number; + points: number; + }; + DashboardFriendSummaryDTO: { + id: string; + name: string; + country: string; + avatarUrl: string; + }; + DashboardFeedSummaryDTO: { + notificationCount: number; + }; + DashboardFeedItemSummaryDTO: { + id: string; + enum: string; + }; + DashboardDriverSummaryDTO: { + id: string; + name: string; + country: string; + avatarUrl: string; + }; + ApplyPenaltyCommandDTO: { + raceId: string; + driverId: string; + stewardId: string; + enum: string; + }; + RequestAvatarGenerationInputDTO: { + userId: string; + facePhotoData: string; + suitColor: string; + }; + UpdateLeagueMemberRoleOutputDTO: { + success: boolean; + }; + UpdateLeagueMemberRoleInputDTO: { + leagueId: string; + performerDriverId: string; + targetDriverId: string; + }; + SeasonDTO: { + seasonId: string; + name: string; + leagueId: string; + }; + RemoveLeagueMemberOutputDTO: { + success: boolean; + }; + RemoveLeagueMemberInputDTO: { + leagueId: string; + performerDriverId: string; + targetDriverId: string; + }; + RejectJoinRequestOutputDTO: { + success: boolean; + }; + RejectJoinRequestInputDTO: { + requestId: string; + leagueId: string; + }; + ProtestDTO: { + id: string; + raceId: string; + protestingDriverId: string; + accusedDriverId: string; + /** Format: date-time */ + submittedAt: string; + description: string; + }; + LeagueWithCapacityDTO: { + id: string; + name: string; + }; + LeagueSummaryDTO: { + id: string; + name: string; + }; + LeagueStatsDTO: { + totalMembers: number; + totalRaces: number; + averageRating: number; + }; + LeagueStandingDTO: { + driverId: string; + }; + LeagueSeasonSummaryDTO: { + seasonId: string; + name: string; + status: string; + }; + LeagueMemberDTO: { + driverId: string; + }; + LeagueJoinRequestDTO: { + id: string; + leagueId: string; + driverId: string; + /** Format: date-time */ + requestedAt: string; + }; + LeagueConfigFormModelTimingsDTO: { + raceDayOfWeek: string; + raceTimeHour: number; + raceTimeMinute: number; + }; + LeagueConfigFormModelStructureDTO: { + mode: string; + }; + LeagueConfigFormModelScoringDTO: { + type: string; + points: number; + }; + LeagueConfigFormModelDTO: { + leagueId: string; + }; + LeagueConfigFormModelBasicsDTO: { + name: string; + description: string; + }; + LeagueAdminPermissionsDTO: { + canRemoveMember: boolean; + canUpdateRoles: boolean; + }; + GetLeagueSeasonsQueryDTO: { + leagueId: string; + }; + GetLeagueProtestsQueryDTO: { + leagueId: string; + }; + GetLeagueOwnerSummaryQueryDTO: { + ownerId: string; + leagueId: string; + }; + GetLeagueJoinRequestsQueryDTO: { + leagueId: string; + }; + GetLeagueAdminPermissionsInputDTO: { + leagueId: string; + performerDriverId: string; + }; + GetLeagueAdminConfigQueryDTO: { + leagueId: string; + }; + CreateLeagueOutputDTO: { + leagueId: string; + success: boolean; + }; + CreateLeagueInputDTO: { + name: string; + description: string; + }; + ApproveJoinRequestOutputDTO: { + success: boolean; + }; + ApproveJoinRequestInputDTO: { + requestId: string; + leagueId: string; + }; + GetDriverRegistrationStatusQueryDTO: { + raceId: string; + driverId: string; + }; + DriverStatsDTO: { + totalDrivers: number; + }; + DriverRegistrationStatusDTO: { + isRegistered: boolean; + raceId: string; + driverId: string; + }; + DriverLeaderboardItemDTO: { + id: string; + name: string; + rating: number; + skillLevel: string; + nationality: string; + racesCompleted: number; + wins: number; + podiums: number; + isActive: boolean; + rank: number; + }; + CompleteOnboardingOutputDTO: { + success: boolean; + }; + CompleteOnboardingInputDTO: { + firstName: string; + lastName: string; + displayName: string; + country: string; + }; + AuthenticatedUserDTO: { + userId: string; + email: string; + displayName: string; + }; + AuthSessionDTO: { + token: string; + user: components["schemas"]["AuthenticatedUserDTO"]; + }; + RecordPageViewOutputDTO: { + pageViewId: string; + }; + RecordEngagementOutputDTO: { + eventId: string; + engagementWeight: number; + }; + }; + responses: never; + parameters: never; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export type operations = Record; diff --git a/apps/website/lib/types/generated/index.ts b/apps/website/lib/types/generated/index.ts new file mode 100644 index 000000000..740ae4319 --- /dev/null +++ b/apps/website/lib/types/generated/index.ts @@ -0,0 +1,99 @@ +/** + * Auto-generated DTO type exports + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ + +// Re-export all schema types from the generated OpenAPI types +export type { components, paths, operations } from './api'; + +// Re-export individual DTO types +export type { SponsorshipPricingItemDTO } from './SponsorshipPricingItemDTO'; +export type { SponsorshipDetailDTO } from './SponsorshipDetailDTO'; +export type { SponsoredLeagueDTO } from './SponsoredLeagueDTO'; +export type { SponsorSponsorshipsDTO } from './SponsorSponsorshipsDTO'; +export type { SponsorDashboardMetricsDTO } from './SponsorDashboardMetricsDTO'; +export type { SponsorDashboardInvestmentDTO } from './SponsorDashboardInvestmentDTO'; +export type { SponsorDashboardDTO } from './SponsorDashboardDTO'; +export type { GetSponsorSponsorshipsQueryParamsDTO } from './GetSponsorSponsorshipsQueryParamsDTO'; +export type { GetSponsorDashboardQueryParamsDTO } from './GetSponsorDashboardQueryParamsDTO'; +export type { CreateSponsorInputDTO } from './CreateSponsorInputDTO'; +export type { UpdatePaymentStatusInputDTO } from './UpdatePaymentStatusInputDTO'; +export type { PaymentDto } from './PaymentDto'; +export type { MembershipFeeDto } from './MembershipFeeDto'; +export type { MemberPaymentDto } from './MemberPaymentDto'; +export type { PrizeDto } from './PrizeDto'; +export type { WalletDto } from './WalletDto'; +export type { TransactionDto } from './TransactionDto'; +export type { PaymentDTO } from './PaymentDTO'; +export type { WithdrawFromRaceParamsDTO } from './WithdrawFromRaceParamsDTO'; +export type { RequestProtestDefenseCommandDTO } from './RequestProtestDefenseCommandDTO'; +export type { RegisterForRaceParamsDTO } from './RegisterForRaceParamsDTO'; +export type { RacesPageDataRaceDTO } from './RacesPageDataRaceDTO'; +export type { RaceWithSOFDTO } from './RaceWithSOFDTO'; +export type { RaceStatsDTO } from './RaceStatsDTO'; +export type { RaceResultsDetailDTO } from './RaceResultsDetailDTO'; +export type { RaceResultDTO } from './RaceResultDTO'; +export type { RaceProtestDTO } from './RaceProtestDTO'; +export type { RacePenaltyDTO } from './RacePenaltyDTO'; +export type { RaceDetailUserResultDTO } from './RaceDetailUserResultDTO'; +export type { RaceDetailRegistrationDTO } from './RaceDetailRegistrationDTO'; +export type { RaceDetailRaceDTO } from './RaceDetailRaceDTO'; +export type { RaceDetailLeagueDTO } from './RaceDetailLeagueDTO'; +export type { RaceDetailEntryDTO } from './RaceDetailEntryDTO'; +export type { RaceDTO } from './RaceDTO'; +export type { RaceActionParamsDTO } from './RaceActionParamsDTO'; +export type { QuickPenaltyCommandDTO } from './QuickPenaltyCommandDTO'; +export type { ImportRaceResultsDTO } from './ImportRaceResultsDTO'; +export type { GetRaceDetailParamsDTODTO } from './GetRaceDetailParamsDTODTO'; +export type { FileProtestCommandDTO } from './FileProtestCommandDTO'; +export type { DashboardRecentResultDTO } from './DashboardRecentResultDTO'; +export type { DashboardRaceSummaryDTO } from './DashboardRaceSummaryDTO'; +export type { DashboardLeagueStandingSummaryDTO } from './DashboardLeagueStandingSummaryDTO'; +export type { DashboardFriendSummaryDTO } from './DashboardFriendSummaryDTO'; +export type { DashboardFeedSummaryDTO } from './DashboardFeedSummaryDTO'; +export type { DashboardFeedItemSummaryDTO } from './DashboardFeedItemSummaryDTO'; +export type { DashboardDriverSummaryDTO } from './DashboardDriverSummaryDTO'; +export type { ApplyPenaltyCommandDTO } from './ApplyPenaltyCommandDTO'; +export type { RequestAvatarGenerationInputDTO } from './RequestAvatarGenerationInputDTO'; +export type { UpdateLeagueMemberRoleOutputDTO } from './UpdateLeagueMemberRoleOutputDTO'; +export type { UpdateLeagueMemberRoleInputDTO } from './UpdateLeagueMemberRoleInputDTO'; +export type { SeasonDTO } from './SeasonDTO'; +export type { RemoveLeagueMemberOutputDTO } from './RemoveLeagueMemberOutputDTO'; +export type { RemoveLeagueMemberInputDTO } from './RemoveLeagueMemberInputDTO'; +export type { RejectJoinRequestOutputDTO } from './RejectJoinRequestOutputDTO'; +export type { RejectJoinRequestInputDTO } from './RejectJoinRequestInputDTO'; +export type { ProtestDTO } from './ProtestDTO'; +export type { LeagueWithCapacityDTO } from './LeagueWithCapacityDTO'; +export type { LeagueSummaryDTO } from './LeagueSummaryDTO'; +export type { LeagueStatsDTO } from './LeagueStatsDTO'; +export type { LeagueStandingDTO } from './LeagueStandingDTO'; +export type { LeagueSeasonSummaryDTO } from './LeagueSeasonSummaryDTO'; +export type { LeagueMemberDTO } from './LeagueMemberDTO'; +export type { LeagueJoinRequestDTO } from './LeagueJoinRequestDTO'; +export type { LeagueConfigFormModelTimingsDTO } from './LeagueConfigFormModelTimingsDTO'; +export type { LeagueConfigFormModelStructureDTO } from './LeagueConfigFormModelStructureDTO'; +export type { LeagueConfigFormModelScoringDTO } from './LeagueConfigFormModelScoringDTO'; +export type { LeagueConfigFormModelDTO } from './LeagueConfigFormModelDTO'; +export type { LeagueConfigFormModelBasicsDTO } from './LeagueConfigFormModelBasicsDTO'; +export type { LeagueAdminPermissionsDTO } from './LeagueAdminPermissionsDTO'; +export type { GetLeagueSeasonsQueryDTO } from './GetLeagueSeasonsQueryDTO'; +export type { GetLeagueProtestsQueryDTO } from './GetLeagueProtestsQueryDTO'; +export type { GetLeagueOwnerSummaryQueryDTO } from './GetLeagueOwnerSummaryQueryDTO'; +export type { GetLeagueJoinRequestsQueryDTO } from './GetLeagueJoinRequestsQueryDTO'; +export type { GetLeagueAdminPermissionsInputDTO } from './GetLeagueAdminPermissionsInputDTO'; +export type { GetLeagueAdminConfigQueryDTO } from './GetLeagueAdminConfigQueryDTO'; +export type { CreateLeagueOutputDTO } from './CreateLeagueOutputDTO'; +export type { CreateLeagueInputDTO } from './CreateLeagueInputDTO'; +export type { ApproveJoinRequestOutputDTO } from './ApproveJoinRequestOutputDTO'; +export type { ApproveJoinRequestInputDTO } from './ApproveJoinRequestInputDTO'; +export type { GetDriverRegistrationStatusQueryDTO } from './GetDriverRegistrationStatusQueryDTO'; +export type { DriverStatsDTO } from './DriverStatsDTO'; +export type { DriverRegistrationStatusDTO } from './DriverRegistrationStatusDTO'; +export type { DriverLeaderboardItemDTO } from './DriverLeaderboardItemDTO'; +export type { CompleteOnboardingOutputDTO } from './CompleteOnboardingOutputDTO'; +export type { CompleteOnboardingInputDTO } from './CompleteOnboardingInputDTO'; +export type { AuthenticatedUserDTO } from './AuthenticatedUserDTO'; +export type { AuthSessionDTO } from './AuthSessionDTO'; +export type { RecordPageViewOutputDTO } from './RecordPageViewOutputDTO'; +export type { RecordEngagementOutputDTO } from './RecordEngagementOutputDTO'; diff --git a/package.json b/package.json index 508225e1a..39430c4c9 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "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-spec": "tsx scripts/generate-openapi-spec.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 \"$@\"", diff --git a/scripts/generate-api-types.ts b/scripts/generate-api-types.ts index 187935876..e9ab1c888 100644 --- a/scripts/generate-api-types.ts +++ b/scripts/generate-api-types.ts @@ -1,113 +1,238 @@ #!/usr/bin/env tsx +/** + * Generate TypeScript types from OpenAPI spec + * + * This script uses openapi-typescript to generate proper TypeScript types + * from the OpenAPI spec that NestJS/Swagger generates. + * + * Usage: + * 1. First generate the OpenAPI spec: npm run api:generate-spec + * 2. Then generate types: npm run api:generate-types + * + * Or use: npm run api:sync-types (runs both) + */ + +import { execSync } from 'child_process'; import fs from 'fs/promises'; import path from 'path'; -async function generateIndividualDTOs() { +async function generateTypes() { const openapiPath = path.join(__dirname, '../apps/api/openapi.json'); const outputDir = path.join(__dirname, '../apps/website/lib/types/generated'); + const outputFile = path.join(outputDir, 'api.ts'); - console.log('🔄 Generating individual DTO files from OpenAPI spec...'); + console.log('🔄 Generating TypeScript types from OpenAPI spec...'); + // Check if OpenAPI spec exists 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'); + console.error('Run "npm run api:generate-spec" first to generate the OpenAPI spec from NestJS'); process.exit(1); } + // Ensure output directory exists + await fs.mkdir(outputDir, { recursive: true }); + 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}`); + // Use openapi-typescript to generate types + console.log('📝 Running openapi-typescript...'); + execSync(`npx openapi-typescript "${openapiPath}" -o "${outputFile}"`, { + stdio: 'inherit', + cwd: path.join(__dirname, '..') + }); + console.log(`✅ TypeScript types generated at: ${outputFile}`); + + // Generate individual DTO files + await generateIndividualDtoFiles(openapiPath, outputDir); + } catch (error) { - console.error('❌ Failed to generate DTOs:', error); + console.error('❌ Failed to generate types:', error); process.exit(1); } } -function generateTypeScriptInterface(name: string, schema: any): string { - const properties = schema.properties || {}; - const required = schema.required || []; +async function generateIndividualDtoFiles(openapiPath: string, outputDir: string) { + console.log('📝 Generating individual DTO files...'); + + const specContent = await fs.readFile(openapiPath, 'utf-8'); + const spec = JSON.parse(specContent); + const schemas = spec.components?.schemas || {}; + + const schemaNames = Object.keys(schemas); + + // Generate individual files for each schema + for (const schemaName of schemaNames) { + const schema = schemas[schemaName]; + const fileName = `${schemaName}.ts`; + const filePath = path.join(outputDir, fileName); + + const fileContent = generateDtoFileContent(schemaName, schema, schemas); + await fs.writeFile(filePath, fileContent); + console.log(` ✅ Generated ${fileName}`); + } + + // Generate index file that re-exports all DTOs + let indexContent = `/** + * Auto-generated DTO type exports + * This file is generated by scripts/generate-api-types.ts + * Do not edit manually - regenerate using: npm run api:sync-types + */ - let interfaceContent = `/** +// Re-export all schema types from the generated OpenAPI types +export type { components, paths, operations } from './api'; + +// Re-export individual DTO types +`; + + for (const schemaName of schemaNames) { + indexContent += `export type { ${schemaName} } from './${schemaName}';\n`; + } + + const indexPath = path.join(outputDir, 'index.ts'); + await fs.writeFile(indexPath, indexContent); + + console.log(`✅ Generated ${schemaNames.length} individual DTO files and index at: ${outputDir}`); +} + +function generateDtoFileContent(schemaName: string, schema: any, allSchemas: Record): string { + // Collect dependencies (referenced DTOs) + const dependencies = new Set(); + collectDependencies(schema, dependencies, allSchemas); + dependencies.delete(schemaName); // Remove self-reference + + let content = `/** * 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`; + // Add imports for dependencies + for (const dep of dependencies) { + content += `import type { ${dep} } from './${dep}';\n`; + } + + if (dependencies.size > 0) { + content += '\n'; } - interfaceContent += '}\n'; - - return interfaceContent; + // Generate interface + content += `export interface ${schemaName} {\n`; + + const properties = schema.properties || {}; + const required = new Set(schema.required || []); + + for (const [propName, propSchema] of Object.entries(properties)) { + const isRequired = required.has(propName); + const optionalMark = isRequired ? '' : '?'; + const typeStr = schemaToTypeString(propSchema as any); + + // Add JSDoc comment for format + if ((propSchema as any).format) { + content += ` /** Format: ${(propSchema as any).format} */\n`; + } + + content += ` ${propName}${optionalMark}: ${typeStr};\n`; + } + + content += '}\n'; + + return content; } -function openApiTypeToTypeScript(schema: any): string { +function collectDependencies(schema: any, deps: Set, allSchemas: Record): void { + if (!schema) return; + if (schema.$ref) { - // Handle references const refName = schema.$ref.split('/').pop(); - return refName; + if (refName && allSchemas[refName]) { + deps.add(refName); + } + return; } + + if (schema.type === 'array' && schema.items) { + collectDependencies(schema.items, deps, allSchemas); + return; + } + + if (schema.properties) { + for (const propSchema of Object.values(schema.properties)) { + collectDependencies(propSchema, deps, allSchemas); + } + } + + if (schema.oneOf) { + for (const subSchema of schema.oneOf) { + collectDependencies(subSchema, deps, allSchemas); + } + } + + if (schema.anyOf) { + for (const subSchema of schema.anyOf) { + collectDependencies(subSchema, deps, allSchemas); + } + } + + if (schema.allOf) { + for (const subSchema of schema.allOf) { + collectDependencies(subSchema, deps, allSchemas); + } + } +} +function schemaToTypeString(schema: any): string { + if (!schema) return 'unknown'; + + if (schema.$ref) { + return schema.$ref.split('/').pop() || 'unknown'; + } + if (schema.type === 'array') { - const itemType = openApiTypeToTypeScript(schema.items); + const itemType = schemaToTypeString(schema.items); return `${itemType}[]`; } - + if (schema.type === 'object') { - // For complex objects, we'll use a generic Record for now - return 'Record'; + if (schema.properties) { + // Inline object type + const props = Object.entries(schema.properties) + .map(([key, val]) => `${key}: ${schemaToTypeString(val as any)}`) + .join('; '); + return `{ ${props} }`; + } + return 'Record'; } - + + if (schema.oneOf) { + return schema.oneOf.map((s: any) => schemaToTypeString(s)).join(' | '); + } + + if (schema.anyOf) { + return schema.anyOf.map((s: any) => schemaToTypeString(s)).join(' | '); + } + + if (schema.enum) { + return schema.enum.map((v: any) => JSON.stringify(v)).join(' | '); + } + 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'; + case 'null': + return 'null'; default: - return 'any'; + return 'unknown'; } } -generateIndividualDTOs().catch(console.error); \ No newline at end of file +generateTypes().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 deleted file mode 100644 index 7b6d9ef81..000000000 --- a/scripts/generate-openapi-from-dtos.ts +++ /dev/null @@ -1,283 +0,0 @@ -#!/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 index 7b6d9ef81..5bdfdbf42 100644 --- a/scripts/generate-openapi-spec.ts +++ b/scripts/generate-openapi-spec.ts @@ -1,39 +1,63 @@ #!/usr/bin/env tsx -import fs from 'fs/promises'; -import path from 'path'; +/** + * Generate OpenAPI spec from NestJS DTO classes + * + * This script scans all DTO files and extracts OpenAPI schema definitions + * using the @nestjs/swagger metadata. + */ + +import 'reflect-metadata'; +import * as fs from 'fs/promises'; +import * as 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...'); +// OpenAPI schema types +interface OpenAPISchema { + type?: string; + format?: string; + $ref?: string; + items?: OpenAPISchema; + properties?: Record; + required?: string[]; + enum?: string[]; + nullable?: boolean; + description?: string; +} - const schemas: Record = {}; +interface OpenAPISpec { + openapi: string; + info: { + title: string; + description: string; + version: string; + }; + paths: Record; + components: { + schemas: Record; + }; +} - // Find all DTO files in the API +async function generateSpec() { + console.log('🔄 Generating OpenAPI spec from DTO files...'); + + const schemas: Record = {}; + + // Find all DTO files const dtoFiles = await glob('apps/api/src/domain/*/dtos/**/*.ts', { - cwd: path.join(__dirname, '..') + cwd: process.cwd() }); 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); + try { + await processDTOFile(path.join(process.cwd(), dtoFile), schemas); + } catch (e: any) { + console.warn(`⚠️ Could not process ${dtoFile}: ${e.message}`); } } - const spec = { + const spec: OpenAPISpec = { openapi: '3.0.0', info: { title: 'GridPilot API', @@ -46,218 +70,183 @@ async function generateComprehensiveOpenAPISpec() { } }; - const outputPath = path.join(__dirname, '../apps/api/openapi.json'); + const outputPath = path.join(process.cwd(), '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}`); + console.log(`✅ 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'); +async function processDTOFile(filePath: string, schemas: Record) { + 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; + // Find class definitions with DTO suffix + const classRegex = /export\s+class\s+(\w+(?:DTO|Dto))\s*(?:extends\s+\w+)?\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/gs; + let classMatch; + + while ((classMatch = classRegex.exec(content)) !== null) { + const className = classMatch[1]; + const classBody = classMatch[2]; + + console.log(` 📝 Processing ${className}`); + + const schema = extractSchemaFromClassBody(classBody, content); + if (schema && Object.keys(schema.properties || {}).length > 0) { + schemas[className] = schema; + console.log(` ✅ Added ${className} with ${Object.keys(schema.properties || {}).length} properties`); } - - 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 = {}; +function extractSchemaFromClassBody(classBody: string, fullContent: string): OpenAPISchema { + 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; + // Split by lines and process each property + const lines = classBody.split('\n'); + let currentDecorators: string[] = []; - while (i < lines.length) { + for (let i = 0; i < lines.length; i++) { 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; - } - } + // Skip empty lines and comments + if (!line || line.startsWith('//') || line.startsWith('/*') || line.startsWith('*')) { + continue; } - i++; - } + // Collect decorators + if (line.startsWith('@')) { + currentDecorators.push(line); + continue; + } - // 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(); + // Check if this is a property declaration + const propertyMatch = line.match(/^(\w+)(\?)?[!]?\s*:\s*(.+?)\s*;?\s*$/); + if (propertyMatch) { + const [, propName, optional, propType] = propertyMatch; - if (!properties[propertyName]) { - // Check if property is required - if (!propertyName.includes('?')) { - required.push(propertyName); + // Skip if propName is a TypeScript/decorator keyword + if (['constructor', 'private', 'public', 'protected', 'static', 'readonly'].includes(propName)) { + currentDecorators = []; + continue; } - properties[propertyName] = mapTypeToSchema(propertyType); + // Determine if required + const hasApiProperty = currentDecorators.some(d => d.includes('@ApiProperty')); + const isOptional = !!optional || + currentDecorators.some(d => d.includes('required: false') || d.includes('@IsOptional')); + const isNullable = currentDecorators.some(d => d.includes('nullable: true')); + + if (!isOptional && !isNullable) { + required.push(propName); + } + + // Extract type from @ApiProperty decorator if present + let schema = extractTypeFromDecorators(currentDecorators, propType); + + properties[propName] = schema; + currentDecorators = []; } } - if (Object.keys(properties).length === 0) { - return null; - } - - const schema: any = { + const result: OpenAPISchema = { type: 'object', properties }; if (required.length > 0) { - schema.required = required; + result.required = required; } - return schema; + return result; } -function extractTypeFromDecorator(decoratorContent: string): any | null { - // Extract type information from @ApiProperty decorator - // Examples: - // @ApiProperty({ type: String }) - // @ApiProperty({ type: [SomeDTO] }) - // @ApiProperty({ type: () => SomeDTO }) +function extractTypeFromDecorators(decorators: string[], tsType: string): OpenAPISchema { + // Join all decorators to search across them + const decoratorStr = decorators.join(' '); - if (decoratorContent.includes('type:')) { - // Simple type extraction - this is a simplified version - // In a real implementation, you'd want proper AST parsing + // Check for @ApiProperty type specification + const apiPropertyMatch = decoratorStr.match(/@ApiProperty\s*\(\s*\{([^}]*)\}\s*\)/s); + + if (apiPropertyMatch) { + const apiPropertyContent = apiPropertyMatch[1]; - if (decoratorContent.includes('[String]') || decoratorContent.includes('[string]')) { - return { type: 'array', items: { type: 'string' } }; + // Check for array type: type: [SomeDTO] + const arrayTypeMatch = apiPropertyContent.match(/type:\s*\[\s*(\w+)\s*\]/); + if (arrayTypeMatch) { + const itemType = arrayTypeMatch[1]; + return { + type: 'array', + items: mapTypeToSchema(itemType) + }; } - if (decoratorContent.includes('[Number]') || decoratorContent.includes('[number]')) { - return { type: 'array', items: { type: 'number' } }; + // Check for function type: type: () => SomeDTO + const funcTypeMatch = apiPropertyContent.match(/type:\s*\(\)\s*=>\s*(\w+)/); + if (funcTypeMatch) { + return mapTypeToSchema(funcTypeMatch[1]); } - if (decoratorContent.includes('String') || decoratorContent.includes('string')) { - return { type: 'string' }; + // Check for direct type reference: type: SomeDTO + const directTypeMatch = apiPropertyContent.match(/type:\s*(\w+)(?:\s*[,}])/); + if (directTypeMatch && !['String', 'Number', 'Boolean', 'string', 'number', 'boolean'].includes(directTypeMatch[1])) { + return mapTypeToSchema(directTypeMatch[1]); } - if (decoratorContent.includes('Number') || decoratorContent.includes('number')) { - return { type: 'number' }; + // Check for enum + const enumMatch = apiPropertyContent.match(/enum:\s*(\w+)/); + if (enumMatch) { + return { type: 'string' }; // Simplify enum to string } - 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]}` }; + // Check for nullable + if (apiPropertyContent.includes('nullable: true')) { + const baseSchema = mapTypeToSchema(tsType); + baseSchema.nullable = true; + return baseSchema; } } - return null; + // Fall back to TypeScript type + return mapTypeToSchema(tsType); } -function mapTypeToSchema(type: string): any { +function mapTypeToSchema(type: string): OpenAPISchema { // Clean up the type - type = type.replace(/[|;]/g, '').trim(); + type = type.replace(/[;!]/g, '').trim(); + + // Handle union with null + if (type.includes('| null') || type.includes('null |')) { + const baseType = type.replace(/\|\s*null/g, '').replace(/null\s*\|/g, '').trim(); + const schema = mapTypeToSchema(baseType); + schema.nullable = true; + return schema; + } // Handle array types if (type.endsWith('[]')) { - const itemType = type.slice(0, -2); + const itemType = type.slice(0, -2).trim(); 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!); - } + // Handle Array syntax + const arrayGenericMatch = type.match(/^Array<(.+)>$/); + if (arrayGenericMatch) { return { - oneOf: types.map(t => mapTypeToSchema(t)) + type: 'array', + items: mapTypeToSchema(arrayGenericMatch[1]) }; } - // Handle basic types - switch (type.toLowerCase()) { + // Handle object literal types (inline objects) + if (type.startsWith('{')) { + return { type: 'object' }; + } + + // Handle primitive types + const lowerType = type.toLowerCase(); + switch (lowerType) { case 'string': return { type: 'string' }; case 'number': @@ -269,15 +258,17 @@ function mapTypeToSchema(type: string): any { 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' }; + case 'object': + return { type: 'object' }; } + + // Handle DTO references + if (type.endsWith('DTO') || type.endsWith('Dto')) { + return { $ref: `#/components/schemas/${type}` }; + } + + // Default to string for unknown types + return { type: 'string' }; } -generateComprehensiveOpenAPISpec().catch(console.error); \ No newline at end of file +generateSpec().catch(console.error); \ No newline at end of file