2026-06-28 22:56:56 +03:30
|
|
|
import { apiClient } from './client';
|
2026-07-07 15:31:09 +03:30
|
|
|
import type {
|
|
|
|
|
LabCaseComment,
|
|
|
|
|
LabTaskListItem,
|
|
|
|
|
LabTaskStatus,
|
|
|
|
|
ListLabTasksParams,
|
|
|
|
|
PaginatedLabTasks,
|
|
|
|
|
} from '@/types/cases';
|
2026-06-28 22:56:56 +03:30
|
|
|
|
|
|
|
|
export const tasksApi = {
|
2026-07-07 15:31:09 +03:30
|
|
|
list: async (
|
|
|
|
|
params: ListLabTasksParams = {},
|
|
|
|
|
): Promise<{ success: boolean; data: PaginatedLabTasks }> => {
|
2026-06-28 22:56:56 +03:30
|
|
|
const response = await apiClient.get('/tasks', { params });
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
updateStatus: async (
|
|
|
|
|
taskId: string,
|
|
|
|
|
status: LabTaskStatus,
|
|
|
|
|
): Promise<{ success: boolean; data: LabTaskListItem }> => {
|
|
|
|
|
const response = await apiClient.patch(`/tasks/${taskId}`, { status });
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
2026-07-07 15:31:09 +03:30
|
|
|
|
|
|
|
|
listComments: async (
|
|
|
|
|
caseId: string,
|
|
|
|
|
): Promise<{ success: boolean; data: LabCaseComment[] }> => {
|
|
|
|
|
const response = await apiClient.get(`/case-comments/${caseId}`);
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addComment: async (
|
|
|
|
|
caseId: string,
|
|
|
|
|
payload: { body: string; visibleToClinic?: boolean },
|
|
|
|
|
): Promise<{ success: boolean; data: LabCaseComment }> => {
|
|
|
|
|
const response = await apiClient.post(`/case-comments/${caseId}`, payload);
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
setCommentVisibility: async (
|
|
|
|
|
commentId: string,
|
|
|
|
|
visibleToClinic: boolean,
|
|
|
|
|
): Promise<{ success: boolean; data: LabCaseComment }> => {
|
|
|
|
|
const response = await apiClient.patch(`/case-comments/item/${commentId}/visibility`, {
|
|
|
|
|
visibleToClinic,
|
|
|
|
|
});
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
2026-06-28 22:56:56 +03:30
|
|
|
};
|