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,8 +0,0 @@
export interface CurrentUserSocialDTO {
driverId: string;
displayName: string;
avatarUrl: string;
countryCode: string;
primaryTeamId?: string;
primaryLeagueId?: string;
}

View File

@@ -1,22 +0,0 @@
export type FeedItemType =
| 'race_result'
| 'championship_standing'
| 'league_announcement'
| 'friend_joined_league'
| 'friend_won_race';
export interface FeedItemDTO {
id: string;
timestamp: string;
type: FeedItemType;
actorFriendId?: string;
actorDriverId?: string;
leagueId?: string;
raceId?: string;
teamId?: string;
position?: number;
headline: string;
body?: string;
ctaLabel?: string;
ctaHref?: string;
}

View File

@@ -1,9 +1,13 @@
export interface FriendDTO {
export type SocialUserSummary = {
driverId: string;
displayName: string;
avatarUrl: string;
countryCode: string;
primaryTeamId?: string;
primaryLeagueId?: string;
};
export type SocialFriendSummary = SocialUserSummary & {
isOnline: boolean;
lastSeen: Date;
primaryLeagueId?: string;
primaryTeamId?: string;
}
};

View File

@@ -2,8 +2,7 @@ import type { Logger, UseCaseOutputPort } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { ISocialGraphRepository } from '../../domain/repositories/ISocialGraphRepository';
import type { CurrentUserSocialDTO } from '../dto/CurrentUserSocialDTO';
import type { FriendDTO } from '../dto/FriendDTO';
import type { SocialFriendSummary, SocialUserSummary } from '../types/SocialUser';
export interface GetCurrentUserSocialParams {
driverId: string;
@@ -12,8 +11,8 @@ export interface GetCurrentUserSocialParams {
export type GetCurrentUserSocialInput = GetCurrentUserSocialParams;
export interface GetCurrentUserSocialResult {
currentUser: CurrentUserSocialDTO;
friends: FriendDTO[];
currentUser: SocialUserSummary;
friends: SocialFriendSummary[];
}
export type GetCurrentUserSocialErrorCode = 'REPOSITORY_ERROR';
@@ -61,15 +60,16 @@ export class GetCurrentUserSocialUseCase {
// The social graph context currently only knows about relationships.
// Profile fields for the current user are expected to be enriched by identity/profile contexts.
const friends: FriendDTO[] = friendsDomain.map((friend) => ({
const friends: SocialFriendSummary[] = friendsDomain.map((friend) => ({
driverId: friend.id,
displayName: friend.name.toString(),
avatarUrl: '',
countryCode: '',
isOnline: false,
lastSeen: new Date(),
}));
const currentUser: CurrentUserSocialDTO = {
const currentUser: SocialUserSummary = {
driverId,
displayName: '',
avatarUrl: '',