wip
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { AsyncUseCase } from '@gridpilot/shared/application';
|
||||
import type { ISocialGraphRepository } from '../../domain/repositories/ISocialGraphRepository';
|
||||
import type { CurrentUserSocialDTO } from '../dto/CurrentUserSocialDTO';
|
||||
import type { FriendDTO } from '../dto/FriendDTO';
|
||||
@@ -16,7 +17,8 @@ export interface GetCurrentUserSocialParams {
|
||||
* Keeps orchestration in the social bounded context while delegating
|
||||
* data access to domain repositories and presenting via a presenter.
|
||||
*/
|
||||
export class GetCurrentUserSocialUseCase {
|
||||
export class GetCurrentUserSocialUseCase
|
||||
implements AsyncUseCase<GetCurrentUserSocialParams, void> {
|
||||
constructor(
|
||||
private readonly socialGraphRepository: ISocialGraphRepository,
|
||||
public readonly presenter: ICurrentUserSocialPresenter,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { AsyncUseCase } from '@gridpilot/shared/application';
|
||||
import type { IFeedRepository } from '../../domain/repositories/IFeedRepository';
|
||||
import type { FeedItemDTO } from '../dto/FeedItemDTO';
|
||||
import type { FeedItem } from '../../domain/entities/FeedItem';
|
||||
import type { FeedItem } from '../../domain/types/FeedItem';
|
||||
import type {
|
||||
IUserFeedPresenter,
|
||||
UserFeedViewModel,
|
||||
@@ -11,7 +12,8 @@ export interface GetUserFeedParams {
|
||||
limit?: number;
|
||||
}
|
||||
|
||||
export class GetUserFeedUseCase {
|
||||
export class GetUserFeedUseCase
|
||||
implements AsyncUseCase<GetUserFeedParams, void> {
|
||||
constructor(
|
||||
private readonly feedRepository: IFeedRepository,
|
||||
public readonly presenter: IUserFeedPresenter,
|
||||
|
||||
@@ -1,8 +1,19 @@
|
||||
export class SocialDomainError extends Error {
|
||||
readonly name: string = 'SocialDomainError';
|
||||
import type { IDomainError, CommonDomainErrorKind } from '@gridpilot/shared/errors';
|
||||
|
||||
constructor(message: string) {
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { FeedItem } from '../entities/FeedItem';
|
||||
import type { FeedItem } from '../types/FeedItem';
|
||||
|
||||
export interface IFeedRepository {
|
||||
getFeedForDriver(driverId: string, limit?: number): Promise<FeedItem[]>;
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import type { FeedItemType } from '../value-objects/FeedItemType';
|
||||
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;
|
||||
15
packages/social/domain/types/FeedItemType.ts
Normal file
15
packages/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';
|
||||
@@ -1,8 +0,0 @@
|
||||
export type FeedItemType =
|
||||
| 'friend-joined-league'
|
||||
| 'friend-joined-team'
|
||||
| 'friend-finished-race'
|
||||
| 'friend-new-personal-best'
|
||||
| 'new-race-scheduled'
|
||||
| 'new-result-posted'
|
||||
| 'league-highlight';
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Driver } from '@gridpilot/racing/domain/entities/Driver';
|
||||
import type { FeedItem } from '@gridpilot/social/domain/entities/FeedItem';
|
||||
import type { FeedItem } from '@gridpilot/social/domain/types/FeedItem';
|
||||
import type { IFeedRepository } from '@gridpilot/social/domain/repositories/IFeedRepository';
|
||||
import type { ISocialGraphRepository } from '@gridpilot/social/domain/repositories/ISocialGraphRepository';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user