first commit

This commit is contained in:
Your NamebaishaliHolocron
2026-06-15 12:57:03 +05:30
commit b9ac5ae0b2
398 changed files with 49583 additions and 0 deletions

View File

@@ -0,0 +1,111 @@
import { ProjectFormData } from "@/app/main/planning/projects/projectModal/zodProject";
import { baseApiRequest } from "../apiRequests/baseApiRequest";
import { Project } from "@/app/main/planning/projects/types/project";
const PROJECT_API = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1/projects`;
const USER_API =
`${process.env.NEXT_PUBLIC_IKON_API_URL}/platform/user/current`;
// CREATE
export const createProjectApi = async (project: ProjectFormData) => {
return baseApiRequest(
PROJECT_API,
{
method: "POST",
body: JSON.stringify(project),
},
{ isAccessTokenRequird: true },
);
};
// READ
export const getProjectsApi = async () => {
return baseApiRequest(
PROJECT_API,
{
method: "GET",
cache: "no-store",
},
{ isAccessTokenRequird: true },
);
};
export const getProjectByIdentifierApi = async (projectId: string) => {
return baseApiRequest(
`${PROJECT_API}/${projectId}`,
{
method: "GET",
cache: "no-store",
},
{ isAccessTokenRequird: true },
);
};
// UPDATE
export const updateProjectApi = async (project: Project) => {
return baseApiRequest(
`${PROJECT_API}/${project.projectIdentifier}`,
{
method: "PUT",
body: JSON.stringify(project),
},
{ isAccessTokenRequird: true },
);
};
export const getScheduleApi = async (projectId: string) => {
return baseApiRequest(
`${PROJECT_API}/${projectId}/schedules`,
{
method: "GET",
cache: "no-store"
},
{ isAccessTokenRequird: true },
);
};
export const getAllSchedulesApi = async () => {
return baseApiRequest(
`${PROJECT_API}/schedules`,
{
method: "GET",
cache: "no-store"
},
{ isAccessTokenRequird: true },
);
};
export const saveScheduleApi = async (
projectId: string,
scheduleData: { task: any[]; dependency: any[]; group?: Record<string, any> },
) => {
return baseApiRequest(
`${PROJECT_API}/${projectId}/schedules`,
{ method: "PUT", body: JSON.stringify(scheduleData) },
{ isAccessTokenRequird: true },
);
};
export const getUsersApi = async () => {
return baseApiRequest(
USER_API,
{
method: "GET",
cache: "no-store",
},
{
isAccessTokenRequird: true,
},
);
};
export const getAllActiveProjectsTimelineApi = async () => {
return baseApiRequest(
`${PROJECT_API}/active-projects-timeline`,
{
method: "GET",
cache: "no-store",
},
{ isAccessTokenRequird: true },
);
};