website refactor

This commit is contained in:
2026-01-13 23:33:07 +01:00
parent 87572f5b1f
commit 8d7c709e0c
4 changed files with 318 additions and 25 deletions

View File

@@ -18,7 +18,6 @@
* - They return Result<ApiDto, DomainError>
*/
import { Result } from '@/lib/contracts/Result';
/**
* Domain error type for services
@@ -35,16 +34,19 @@ export type DomainError =
/**
* Service interface for orchestration operations
* All service methods must return Result with domain errors
*
* Design Decision: Services with multiple methods CANNOT use a single generic type
* because each method may return different DTOs. Instead:
*
* 1. Single-method services (PageQueries, Mutations): Use Service<TApiDto, TError>
* 2. Multi-method services: Don't implement this interface, just follow the pattern
*
* All service methods must return Promise<Result<T, DomainError>> for type-safe error handling.
*
* Type Parameters:
* - TApiDto: The API Transport DTO type returned on success
* - TError: The domain error type (defaults to DomainError)
*/
export interface Service<TApiDto = unknown, TError extends DomainError = DomainError> {
/**
* Execute a service operation
* Returns Result with API DTO or Domain Error
*/
execute(...args: unknown[]): Promise<Result<TApiDto, TError>>;
export interface Service {
// No specific methods - just a marker type
}