feat(services): F005 – complete service layer
New domain types: - shortlist.ts: Shortlist, ShortlistItem, CreateShortlistInput - review.ts: ReviewQueueItem, ReviewPriority, ReviewQueueStatus New mock data: - shortlists.ts: 2 sample shortlists - reviewQueue.ts: 3 pending review items New providers (interface + mockup): - IShortlistProvider / MockupShortlistProvider (with 150ms latency) - IReviewProvider / MockupReviewProvider (priority-sorted, with latency) - IDashboardProvider / MockupDashboardProvider (computed from all mock data) New services: - reviewService: getQueue, approve, reject, assign - shortlistService: CRUD + addItem/removeItem - authService: wraps sessionStore, swappable for real auth - dashboardService: getStats(organizationId?) Enhancements: - types.ts: typed ServiceErrorCode + ServiceError, Pagination alias - aiService.ts: openRouterAIService stub (throws ai_generation_failed) - lib/mockUtils.ts: mockDelay(ms) utility New hooks: - useUnifiedResults(needId?): joins matches+properties+signals → UnifiedMatchResult[] - useReviewQueue: + useApproveReviewItem + useRejectReviewItem - useMatchDetail, usePropertyDetail, useNeedProfiles aliases Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+30
-3
@@ -1,14 +1,41 @@
|
||||
export interface ServiceMeta {
|
||||
// ── Error Codes ───────────────────────────────────────────────────────────────
|
||||
|
||||
export const ServiceErrorCode = {
|
||||
NETWORK_ERROR: 'network_error',
|
||||
UNAUTHORIZED: 'unauthorized',
|
||||
FORBIDDEN: 'forbidden',
|
||||
VALIDATION_ERROR: 'validation_error',
|
||||
NOT_FOUND: 'not_found',
|
||||
AI_GENERATION_FAILED: 'ai_generation_failed',
|
||||
BACKEND_UNAVAILABLE: 'backend_unavailable',
|
||||
} as const
|
||||
export type ServiceErrorCode = typeof ServiceErrorCode[keyof typeof ServiceErrorCode]
|
||||
|
||||
export interface ServiceError {
|
||||
code: ServiceErrorCode
|
||||
message: string
|
||||
details?: unknown
|
||||
}
|
||||
|
||||
// ── Pagination ────────────────────────────────────────────────────────────────
|
||||
|
||||
export interface Pagination {
|
||||
total: number
|
||||
page: number
|
||||
pageSize: number
|
||||
hasMore: boolean
|
||||
}
|
||||
|
||||
/** @deprecated Use Pagination */
|
||||
export type ServiceMeta = Pagination
|
||||
|
||||
// ── Response Shapes ───────────────────────────────────────────────────────────
|
||||
|
||||
export interface ServiceResponse<T> {
|
||||
data: T
|
||||
meta?: ServiceMeta
|
||||
error?: string | null
|
||||
meta?: Pagination
|
||||
pagination?: Pagination
|
||||
error?: ServiceError | string | null
|
||||
}
|
||||
|
||||
export type ListResponse<T> = ServiceResponse<T[]>
|
||||
|
||||
Reference in New Issue
Block a user