37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import client from '../api/client';
|
|
|
|
const API_BASE = '/collaboration';
|
|
|
|
export const worknoteService = {
|
|
getWorknotes: async (requestId: string, requestType: string) => {
|
|
const response = await client.get(`${API_BASE}/worknotes`, { requestId, requestType });
|
|
return response.data;
|
|
},
|
|
|
|
addWorknote: async (data: {
|
|
requestId: string;
|
|
requestType: string;
|
|
noteText: string;
|
|
noteType?: string;
|
|
tags?: string[];
|
|
attachmentDocIds?: string[];
|
|
}) => {
|
|
const response = await client.post(`${API_BASE}/worknotes`, data);
|
|
return response.data;
|
|
},
|
|
|
|
uploadAttachment: async (file: File, requestId?: string, requestType?: string) => {
|
|
const formData = new FormData();
|
|
formData.append('file', file);
|
|
if (requestId) formData.append('requestId', requestId);
|
|
if (requestType) formData.append('requestType', requestType);
|
|
|
|
const response = await client.post(`${API_BASE}/upload`, formData, {
|
|
headers: { 'Content-Type': 'multipart/form-data' }
|
|
});
|
|
return response.data;
|
|
}
|
|
};
|
|
|
|
export default worknoteService;
|