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>
66 lines
1.4 KiB
TypeScript
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;
|
|
}
|