rename to core

This commit is contained in:
2025-12-15 13:46:07 +01:00
parent aedf58643d
commit 5c22f8820c
559 changed files with 415 additions and 767 deletions

View File

@@ -0,0 +1,19 @@
import type { IDomainError, CommonDomainErrorKind } from '@gridpilot/shared/errors';
/**
* Domain Error: SocialDomainError
*
* Implements the shared IDomainError contract for social domain failures.
*/
export class SocialDomainError extends Error implements IDomainError<CommonDomainErrorKind> {
readonly name = 'SocialDomainError';
readonly type = 'domain' as const;
readonly context = 'social';
readonly kind: CommonDomainErrorKind;
constructor(message: string, kind: CommonDomainErrorKind = 'validation') {
super(message);
this.kind = kind;
Object.setPrototypeOf(this, new.target.prototype);
}
}

View File

@@ -0,0 +1,6 @@
import type { FeedItem } from '../types/FeedItem';
export interface IFeedRepository {
getFeedForDriver(driverId: string, limit?: number): Promise<FeedItem[]>;
getGlobalFeed(limit?: number): Promise<FeedItem[]>;
}

View File

@@ -0,0 +1,7 @@
import type { Driver } from '@gridpilot/racing/domain/entities/Driver';
export interface ISocialGraphRepository {
getFriends(driverId: string): Promise<Driver[]>;
getFriendIds(driverId: string): Promise<string[]>;
getSuggestedFriends(driverId: string, limit?: number): Promise<Driver[]>;
}

View File

@@ -0,0 +1,23 @@
import type { FeedItemType } from './FeedItemType';
/**
* Domain Type: FeedItem
*
* Pure feed item shape used by repositories and application DTO mappers.
* This is not a domain entity (no identity/behavior beyond data).
*/
export interface FeedItem {
id: string;
timestamp: Date;
type: FeedItemType;
actorFriendId?: string;
actorDriverId?: string;
leagueId?: string;
raceId?: string;
teamId?: string;
position?: number;
headline: string;
body?: string;
ctaLabel?: string;
ctaHref?: string;
}

View File

@@ -0,0 +1,15 @@
/**
* Domain Type: FeedItemType
*
* Union representing the kinds of items that can appear in a user's social feed.
* This is a pure type and therefore belongs in domain/types rather than
* domain/value-objects, which is reserved for class-based value objects.
*/
export type FeedItemType =
| 'friend-joined-league'
| 'friend-joined-team'
| 'friend-finished-race'
| 'friend-new-personal-best'
| 'new-race-scheduled'
| 'new-result-posted'
| 'league-highlight';