feature: a minimal implementation of the appointment feature done.
This commit is contained in:
32
frontend/src/lib/api/appointments.ts
Normal file
32
frontend/src/lib/api/appointments.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user