This commit is contained in:
NotII
2025-04-07 19:25:24 +01:00
parent 7f7dd78818
commit 2f48ee38c2
102 changed files with 1825 additions and 761 deletions

View File

@@ -1,30 +1,8 @@
import { clientFetch } from '@/lib/client-utils';
export interface CustomerStats {
userId: string;
telegramUserId: number;
telegramUsername: string;
totalOrders: number;
totalSpent: number;
ordersByStatus: {
paid: number;
completed: number;
acknowledged: number;
shipped: number;
};
lastOrderDate: string | null;
firstOrderDate: string;
chatId: number;
hasOrders?: boolean;
}
export const getCustomers = async (page: number = 1, limit: number = 25): Promise<{
customers: CustomerStats[];
total: number;
}> => {
return clientFetch(`/customers?page=${page}&limit=${limit}`);
};
export const getCustomerDetails = async (userId: string): Promise<CustomerStats> => {
return clientFetch(`/customers/${userId}`);
};
// This file is maintained for backward compatibility
// Import from the new consolidated API
export {
getCustomers,
getCustomerDetails,
type CustomerStats,
type CustomerResponse
} from '../lib/api';