Files
pn-new-crm/src/types/api.ts
Matt 0e8feb1073 chore: prettier format pass on branch files
Auto-format all files modified during the documents-hub-split feature
branch that were not yet aligned with the project's Prettier config
(single quotes, semicolons, trailing commas).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-11 13:01:47 +02:00

77 lines
1.4 KiB
TypeScript

/**
* Common API response and utility types used across the CRM.
*/
/** Generic wrapper for all API responses */
export interface ApiResponse<T> {
data: T;
success: true;
}
/** Wrapper for API error responses */
export interface ApiErrorResponse {
success: false;
error: ApiError;
}
/** Paginated list response */
export interface PaginatedResponse<T> {
data: T[];
pagination: {
page: number;
pageSize: number;
total: number;
totalPages: number;
hasNextPage: boolean;
hasPreviousPage: boolean;
};
}
/** Standard API error shape */
export interface ApiError {
code: string;
message: string;
field?: string;
details?: Record<string, unknown>;
}
/** Sort configuration for list queries */
export interface SortConfig<T extends string = string> {
field: T;
direction: 'asc' | 'desc';
}
/** Filter configuration for list queries */
export interface FilterConfig {
field: string;
operator:
| 'eq'
| 'neq'
| 'gt'
| 'gte'
| 'lt'
| 'lte'
| 'like'
| 'in'
| 'notIn'
| 'isNull'
| 'isNotNull';
value: string | number | boolean | string[] | number[] | null;
}
/** Standard list query parameters */
export interface ListQueryParams {
page?: number;
pageSize?: number;
sort?: SortConfig;
filters?: FilterConfig[];
search?: string;
}
/** Standard mutation response */
export interface MutationResponse {
success: boolean;
id?: string;
message?: string;
}