mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-09 00:08:18 +00:00
Tour package booking, app release, new endpoints, more updates and fixes
This commit is contained in:
@@ -6,6 +6,8 @@ export const bookingsApi = {
|
||||
getAll: (filters?: BookingFilters) => {
|
||||
const params = new URLSearchParams();
|
||||
if (filters?.status) params.append('status', filters.status);
|
||||
if (filters?.bookingType) params.append('bookingType', filters.bookingType);
|
||||
if (filters?.paymentStatus) params.append('paymentStatus', filters.paymentStatus);
|
||||
if (filters?.dateFrom) params.append('dateFrom', filters.dateFrom);
|
||||
if (filters?.dateTo) params.append('dateTo', filters.dateTo);
|
||||
if (filters?.search) params.append('search', filters.search);
|
||||
|
||||
@@ -158,8 +158,11 @@ export const seatsApi = {
|
||||
// Payments API
|
||||
export const paymentsApi = {
|
||||
getAll: async (params?: any) => {
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const response = await apiClient.get<any>(`/payments${query ? `?${query}` : ''}`);
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([, v]) => v !== '' && v !== undefined && v !== null)
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/payments/all${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
}
|
||||
@@ -229,6 +232,7 @@ export const loyaltyApi = {
|
||||
adjustPoints: (accountId: string, data: any) => apiClient.post<any>(`/loyalty/accounts/${accountId}/adjust`, data),
|
||||
getRewards: () => apiClient.get<any[]>('/loyalty/rewards'),
|
||||
createReward: (data: any) => apiClient.post<any>('/loyalty/rewards', data),
|
||||
delete: (id: string) => apiClient.delete(`/loyalty/accounts/${id}`),
|
||||
};
|
||||
|
||||
// Wallet API
|
||||
@@ -244,6 +248,7 @@ export const walletApi = {
|
||||
getAccount: (passengerId: string) => apiClient.get<any>(`/wallet/accounts/${passengerId}`),
|
||||
adjustBalance: (accountId: string, data: any) => apiClient.post<any>(`/wallet/accounts/${accountId}/adjust`, data),
|
||||
getLedger: (accountId: string) => apiClient.get<any[]>(`/wallet/accounts/${accountId}/ledger`),
|
||||
delete: (id: string) => apiClient.delete(`/wallet/accounts/${id}`),
|
||||
};
|
||||
|
||||
// Promotions API
|
||||
@@ -301,12 +306,14 @@ export const notificationsApi = {
|
||||
// Fraud API
|
||||
export const fraudApi = {
|
||||
getAlerts: async (params?: any) => {
|
||||
const query = new URLSearchParams(params as Record<string, string>).toString();
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([, v]) => v !== '' && v !== undefined && v !== null)
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/fraud/alerts${query ? `?${query}` : ''}`);
|
||||
if (response?.data) {
|
||||
return Array.isArray(response.data) ? { items: response.data } : response;
|
||||
}
|
||||
return Array.isArray(response) ? { items: response } : response;
|
||||
// Backend returns { data: [...], total } or { items: [...] }
|
||||
const arr = (response as any)?.data ?? (response as any)?.items ?? response;
|
||||
return { items: Array.isArray(arr) ? arr : [] };
|
||||
},
|
||||
acknowledgeAlert: (id: string) => apiClient.patch<any>(`/fraud/alerts/${id}/acknowledge`),
|
||||
getRules: () => apiClient.get<any[]>('/fraud/rules'),
|
||||
@@ -403,6 +410,15 @@ export const packagesApi = {
|
||||
activate: (id: string) => apiClient.patch<any>(`/packages/${id}/activate`, {}),
|
||||
deactivate: (id: string) => apiClient.patch<any>(`/packages/${id}/deactivate`, {}),
|
||||
remove: (id: string) => apiClient.delete(`/packages/${id}`),
|
||||
getBookings: async (params?: any) => {
|
||||
const cleanParams = Object.fromEntries(
|
||||
Object.entries(params || {}).filter(([_, value]) => value !== '' && value !== undefined && value !== null)
|
||||
) as Record<string, string>;
|
||||
const query = new URLSearchParams(cleanParams).toString();
|
||||
const response = await apiClient.get<any>(`/packages/bookings${query ? `?${query}` : ''}`);
|
||||
if ((response as any)?.data) return Array.isArray((response as any).data) ? { items: (response as any).data } : response;
|
||||
return Array.isArray(response) ? { items: response } : response;
|
||||
},
|
||||
addTier: (packageId: string, data: any) => apiClient.post<any>(`/packages/${packageId}/tiers`, data),
|
||||
updateTier: (tierId: string, data: any) => apiClient.patch<any>(`/packages/tiers/${tierId}`, data),
|
||||
deleteTier: (tierId: string) => apiClient.delete(`/packages/tiers/${tierId}`),
|
||||
@@ -455,3 +471,14 @@ export const systemConfigApi = {
|
||||
getAll: () => apiClient.get<Record<string, string>>('/config'),
|
||||
update: (data: Record<string, string>) => apiClient.patch<Record<string, string>>('/config', data),
|
||||
};
|
||||
|
||||
// App Releases API
|
||||
export const appReleasesApi = {
|
||||
getAll: async () => {
|
||||
const response = await apiClient.get<any>('/app-releases');
|
||||
return Array.isArray(response) ? response : (response as any)?.items || (response as any)?.data || [];
|
||||
},
|
||||
create: (data: any) => apiClient.post<any>('/app-releases', data),
|
||||
update: (id: string, data: any) => apiClient.patch<any>(`/app-releases/${id}`, data),
|
||||
remove: (id: string) => apiClient.delete(`/app-releases/${id}`),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user