Files
pn-new-crm/src/types/api.ts
Matt 67d7e6e3d5
Some checks failed
Build & Push Docker Images / build-and-push (push) Has been cancelled
Build & Push Docker Images / deploy (push) Has been cancelled
Build & Push Docker Images / lint (push) Has been cancelled
Initial commit: Port Nimara CRM (Layers 0-4)
Full CRM rebuild with Next.js 15, TypeScript, Tailwind, Drizzle ORM,
PostgreSQL, Redis, BullMQ, MinIO, and Socket.io. Includes 461 source
files covering clients, berths, interests/pipeline, documents/EOI,
expenses/invoices, email, notifications, dashboard, admin, and
client portal. CI/CD via Gitea Actions with Docker builds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 11:52:51 +01:00

66 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;
}