feat:add doctor page

This commit is contained in:
ARJUN S THAMPI
2026-03-17 13:11:00 +05:30
parent db8cee836a
commit 763b887d65
11 changed files with 962 additions and 34 deletions
+4 -12
View File
@@ -10,15 +10,11 @@ export interface Department {
services: string;
}
/* ---------------- GET ALL ---------------- */
export const getDepartmentsApi = async () => {
const res = await apiClient.get("/departments/getAll");
return res.data;
};
/* ---------------- CREATE ---------------- */
export const createDepartmentApi = async (data: {
departmentId: string;
name: string;
@@ -32,10 +28,8 @@ export const createDepartmentApi = async (data: {
return res.data;
};
/* ---------------- UPDATE ---------------- */
export const updateDepartmentApi = async (
id: number,
departmentId: string,
data: {
name?: string;
para1?: string;
@@ -45,13 +39,11 @@ export const updateDepartmentApi = async (
services?: string;
},
) => {
const res = await apiClient.put(`/departments/${id}`, data);
const res = await apiClient.put(`/departments/${departmentId}`, data);
return res.data;
};
/* ---------------- DELETE ---------------- */
export const deleteDepartmentApi = async (id: number) => {
const res = await apiClient.delete(`/departments/${id}`);
export const deleteDepartmentApi = async (departmentId: string) => {
const res = await apiClient.delete(`/departments/${departmentId}`);
return res.data;
};
+53
View File
@@ -0,0 +1,53 @@
import apiClient from "@/api/client";
export interface Doctor {
doctorId: string;
name: string;
designation?: string;
workingStatus?: string;
qualification?: string;
departments: string[];
timing: {
monday?: string;
tuesday?: string;
wednesday?: string;
thursday?: string;
friday?: string;
saturday?: string;
sunday?: string;
additional?: string;
};
}
export const getDoctorsApi = async () => {
const res = await apiClient.get("/doctors/getAll");
return res.data;
};
export const getDoctorByIdApi = async (doctorId: string) => {
const res = await apiClient.get(`/doctors/${doctorId}`);
return res.data;
};
export const createDoctorApi = async (data: Doctor) => {
const res = await apiClient.post("/doctors", data);
return res.data;
};
export const updateDoctorApi = async (
doctorId: string,
data: Partial<Doctor>,
) => {
const res = await apiClient.patch(`/doctors/${doctorId}`, data);
return res.data;
};
export const deleteDoctorApi = async (doctorId: string) => {
const res = await apiClient.delete(`/doctors/${doctorId}`);
return res.data;
};
export const getDoctorTimingApi = async (doctorId: string) => {
const res = await apiClient.get(`/doctors/getTimings/${doctorId}`);
return res.data;
};