feat: add department dashboard

This commit is contained in:
ARJUN S THAMPI
2026-03-16 17:55:33 +05:30
parent aaa62ae3f5
commit 46bbd8106b
23 changed files with 1621 additions and 684 deletions

View File

@@ -0,0 +1,57 @@
import apiClient from "@/api/client";
export interface Department {
departmentId: string;
name: string;
para1: string;
para2: string;
para3: string;
facilities: string;
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;
para1?: string;
para2?: string;
para3?: string;
facilities?: string;
services?: string;
}) => {
const res = await apiClient.post("/departments", data);
return res.data;
};
/* ---------------- UPDATE ---------------- */
export const updateDepartmentApi = async (
id: number,
data: {
name?: string;
para1?: string;
para2?: string;
para3?: string;
facilities?: string;
services?: string;
},
) => {
const res = await apiClient.put(`/departments/${id}`, data);
return res.data;
};
/* ---------------- DELETE ---------------- */
export const deleteDepartmentApi = async (id: number) => {
const res = await apiClient.delete(`/departments/${id}`);
return res.data;
};