rename to core
This commit is contained in:
19
core/social/domain/errors/SocialDomainError.ts
Normal file
19
core/social/domain/errors/SocialDomainError.ts
Normal 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);
|
||||
}
|
||||
}
|
||||
6
core/social/domain/repositories/IFeedRepository.ts
Normal file
6
core/social/domain/repositories/IFeedRepository.ts
Normal 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[]>;
|
||||
}
|
||||
@@ -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[]>;
|
||||
}
|
||||
23
core/social/domain/types/FeedItem.ts
Normal file
23
core/social/domain/types/FeedItem.ts
Normal 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;
|
||||
}
|
||||
15
core/social/domain/types/FeedItemType.ts
Normal file
15
core/social/domain/types/FeedItemType.ts
Normal 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';
|
||||
Reference in New Issue
Block a user