33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
|
|
import { apiClient } from './client';
|
||
|
|
import type { AppointmentColumnProvider, AppointmentRecord } from '@/types/appointment';
|
||
|
|
|
||
|
|
export interface CreateAppointmentBody {
|
||
|
|
patientId: string;
|
||
|
|
providerUserId: string;
|
||
|
|
startAt: string;
|
||
|
|
endAt: string;
|
||
|
|
purpose: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const appointmentsApi = {
|
||
|
|
columnProviders: async (): Promise<{ success: boolean; data: AppointmentColumnProvider[] }> => {
|
||
|
|
const response = await apiClient.get('/appointments/column-providers');
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
list: async (params: { from: string; to: string }): Promise<{ success: boolean; data: AppointmentRecord[] }> => {
|
||
|
|
const response = await apiClient.get('/appointments', { params });
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
create: async (body: CreateAppointmentBody): Promise<{ success: boolean; data: AppointmentRecord }> => {
|
||
|
|
const response = await apiClient.post('/appointments', body);
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
|
||
|
|
remove: async (id: string): Promise<{ success: boolean }> => {
|
||
|
|
const response = await apiClient.delete(`/appointments/${id}`);
|
||
|
|
return response.data;
|
||
|
|
},
|
||
|
|
};
|