54 lines
1.5 KiB
TypeScript
54 lines
1.5 KiB
TypeScript
import { apiClient } from '@/lib/api-client';
|
|
import type {
|
|
DocumentSequenceDetailResponse,
|
|
DocumentSequenceListResponse,
|
|
DocumentSequenceMutationPayload,
|
|
DocumentSequencePreviewResponse,
|
|
DocumentSequenceResetPayload,
|
|
MutationSuccessResponse
|
|
} from './types';
|
|
|
|
const BASE_PATH = '/crm/settings/document-sequences';
|
|
|
|
export async function getDocumentSequences() {
|
|
return apiClient<DocumentSequenceListResponse>(BASE_PATH);
|
|
}
|
|
|
|
export async function getDocumentSequenceById(id: string) {
|
|
return apiClient<DocumentSequenceDetailResponse>(`${BASE_PATH}/${id}`);
|
|
}
|
|
|
|
export async function createDocumentSequence(data: DocumentSequenceMutationPayload) {
|
|
return apiClient<MutationSuccessResponse>(BASE_PATH, {
|
|
method: 'POST',
|
|
body: JSON.stringify(data)
|
|
});
|
|
}
|
|
|
|
export async function updateDocumentSequence(
|
|
id: string,
|
|
data: Partial<DocumentSequenceMutationPayload>
|
|
) {
|
|
return apiClient<MutationSuccessResponse>(`${BASE_PATH}/${id}`, {
|
|
method: 'PATCH',
|
|
body: JSON.stringify(data)
|
|
});
|
|
}
|
|
|
|
export async function deleteDocumentSequence(id: string) {
|
|
return apiClient<MutationSuccessResponse>(`${BASE_PATH}/${id}`, {
|
|
method: 'DELETE'
|
|
});
|
|
}
|
|
|
|
export async function previewDocumentSequence(id: string) {
|
|
return apiClient<DocumentSequencePreviewResponse>(`${BASE_PATH}/${id}/preview`);
|
|
}
|
|
|
|
export async function resetDocumentSequence(id: string, data: DocumentSequenceResetPayload) {
|
|
return apiClient<MutationSuccessResponse>(`${BASE_PATH}/${id}/reset`, {
|
|
method: 'POST',
|
|
body: JSON.stringify(data)
|
|
});
|
|
}
|