weewoo
This commit is contained in:
@@ -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';
|
||||
3
services/index.ts
Normal file
3
services/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
// Re-export all services from the lib directory
|
||||
// This provides backward compatibility
|
||||
export * from '../lib/api';
|
||||
Reference in New Issue
Block a user