fix issues in core

This commit is contained in:
2025-12-23 17:31:45 +01:00
parent d04a21fe02
commit 4318b380d9
34 changed files with 116 additions and 103 deletions

View File

@@ -1,19 +1,19 @@
import { randomUUID } from 'crypto';
import { createStaticRacingSeed } from '@core/testing-support';
import type { IdentityProviderPort } from '../../application/ports/IdentityProviderPort';
import type { StartAuthCommandDTO } from '../../application/dto/StartAuthCommandDTO';
import type { AuthCallbackCommandDTO } from '../../application/dto/AuthCallbackCommandDTO';
import type { AuthenticatedUserDTO } from '../../application/dto/AuthenticatedUserDTO';
import type {
AuthCallbackCommand,
AuthenticatedUser,
IdentityProviderPort,
StartAuthCommand,
} from '@core/identity/application/ports/IdentityProviderPort';
export class IracingDemoIdentityProviderAdapter implements IdentityProviderPort {
private readonly seedDriverId: string;
constructor() {
const seed = createStaticRacingSeed(42);
this.seedDriverId = seed.drivers[0]?.id ?? 'driver-1';
this.seedDriverId = 'driver-1';
}
async startAuth(command: StartAuthCommandDTO): Promise<{ redirectUrl: string; state: string }> {
async startAuth(command: StartAuthCommand): Promise<{ redirectUrl: string; state: string }> {
const state = randomUUID();
const params = new URLSearchParams();
@@ -29,7 +29,7 @@ export class IracingDemoIdentityProviderAdapter implements IdentityProviderPort
};
}
async completeAuth(command: AuthCallbackCommandDTO): Promise<AuthenticatedUserDTO> {
async completeAuth(command: AuthCallbackCommand): Promise<AuthenticatedUser> {
if (!command.code) {
throw new Error('Missing auth code');
}
@@ -37,7 +37,7 @@ export class IracingDemoIdentityProviderAdapter implements IdentityProviderPort
throw new Error('Missing auth state');
}
const user: AuthenticatedUserDTO = {
const user: AuthenticatedUser = {
id: 'demo-user',
displayName: 'GridPilot Demo Driver',
iracingCustomerId: '000000',

View File

@@ -3,7 +3,7 @@ import { League } from '@core/racing/domain/entities/League';
import { Race } from '@core/racing/domain/entities/Race';
import type { Result } from '@core/racing/domain/entities/Result';
import type { FeedItem } from '@core/social/domain/types/FeedItem';
import type { FriendDTO } from '@core/social/application/dto/FriendDTO';
import type { SocialFriendSummary } from '@core/social/application/types/SocialUser';
import { faker } from '../../helpers/faker/faker';
import { getLeagueBanner, getDriverAvatar } from '../../helpers/images/images';
import type { Friendship, RacingMembership } from './RacingSeedCore';
@@ -166,11 +166,11 @@ export function createFeedEvents(
export function buildFriends(
drivers: Driver[],
memberships: RacingMembership[],
): FriendDTO[] {
): SocialFriendSummary[] {
return drivers.map((driver) => {
const membership = memberships.find((m) => m.driverId === driver.id);
const base: FriendDTO = {
const base: SocialFriendSummary = {
driverId: driver.id,
displayName: driver.name,
avatarUrl: getDriverAvatar(driver.id),

View File

@@ -5,7 +5,7 @@ import { Result } from '@core/racing/domain/entities/Result';
import { Standing } from '@core/racing/domain/entities/Standing';
import type { FeedItem } from '@core/social/domain/types/FeedItem';
import type { FriendDTO } from '@core/social/application/dto/FriendDTO';
import type { SocialFriendSummary } from '@core/social/application/types/SocialUser';
import { faker } from '../../helpers/faker/faker';
import { getTeamLogo } from '../../helpers/images/images';
@@ -128,7 +128,7 @@ export const sponsorshipPricings = staticSeed.sponsorshipPricings;
* Derived friend DTOs for UI consumption.
* This preserves the previous demo-data `friends` shape.
*/
export const friends: FriendDTO[] = buildFriends(staticSeed.drivers, staticSeed.memberships);
export const friends: SocialFriendSummary[] = buildFriends(staticSeed.drivers, staticSeed.memberships);
/**
* Top leagues with banner URLs for UI.

View File

@@ -0,0 +1,9 @@
export interface FriendDTO {
driverId: string;
displayName: string;
avatarUrl: string;
isOnline: boolean;
lastSeen: Date;
primaryLeagueId?: string;
primaryTeamId?: string;
}