[#NUMERO_TICKET] TITRE TICKET #2

Merged
malio merged 302 commits from develop into main 2026-03-18 13:16:19 +00:00
Showing only changes of commit adf050505d - Show all commits

View File

@@ -28,6 +28,26 @@ export function useTaskDocumentService() {
})
}
async function uploadForTicket(clientTicketId: number, file: File): Promise<TaskDocument> {
const formData = new FormData()
formData.append('file', file)
formData.append('clientTicket', `/api/client_tickets/${clientTicketId}`)
return await $fetch<TaskDocument>(`${baseURL}/task_documents`, {
method: 'POST',
body: formData,
credentials: 'include',
// Do NOT set Content-Type — browser sets multipart boundary automatically
})
}
async function getByTicket(clientTicketId: number): Promise<TaskDocument[]> {
const data = await api.get<HydraCollection<TaskDocument>>('/task_documents', {
clientTicket: `/api/client_tickets/${clientTicketId}`,
})
return extractHydraMembers(data)
}
async function remove(id: number): Promise<void> {
await api.delete(`/task_documents/${id}`, {}, {
toastSuccessKey: 'taskDocuments.deleted',
@@ -38,5 +58,5 @@ export function useTaskDocumentService() {
return `${baseURL}/task_documents/${id}/download`
}
return { getByTask, upload, remove, getDownloadUrl }
return { getByTask, upload, uploadForTicket, getByTicket, remove, getDownloadUrl }
}