added contract history
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import axios from 'axios';
|
||||
import type { ApiResponse, Customer, Contract, ContractTask, ContractTaskSubtask, ContractTaskStatus, SalesPlatform, CancellationPeriod, ContractDuration, ContractCategory, Provider, Tariff, User, Address, BankCard, IdentityDocument, Meter, MeterReading, Invoice, Role, PortalSettings, CustomerRepresentative, CustomerSummary } from '../types';
|
||||
import type { ApiResponse, Customer, Contract, ContractTask, ContractTaskSubtask, ContractTaskStatus, SalesPlatform, CancellationPeriod, ContractDuration, ContractCategory, Provider, Tariff, User, Address, BankCard, IdentityDocument, Meter, MeterReading, Invoice, Role, PortalSettings, CustomerRepresentative, CustomerSummary, ContractHistoryEntry } from '../types';
|
||||
|
||||
const api = axios.create({
|
||||
baseURL: '/api',
|
||||
@@ -648,6 +648,26 @@ export const contractApi = {
|
||||
},
|
||||
};
|
||||
|
||||
// Contract History (Vertragshistorie - nur intern)
|
||||
export const contractHistoryApi = {
|
||||
getByContract: async (contractId: number) => {
|
||||
const res = await api.get<ApiResponse<ContractHistoryEntry[]>>(`/contracts/${contractId}/history`);
|
||||
return res.data;
|
||||
},
|
||||
create: async (contractId: number, data: { title: string; description?: string }) => {
|
||||
const res = await api.post<ApiResponse<ContractHistoryEntry>>(`/contracts/${contractId}/history`, data);
|
||||
return res.data;
|
||||
},
|
||||
update: async (contractId: number, entryId: number, data: { title?: string; description?: string }) => {
|
||||
const res = await api.put<ApiResponse<ContractHistoryEntry>>(`/contracts/${contractId}/history/${entryId}`, data);
|
||||
return res.data;
|
||||
},
|
||||
delete: async (contractId: number, entryId: number) => {
|
||||
const res = await api.delete<ApiResponse<void>>(`/contracts/${contractId}/history/${entryId}`);
|
||||
return res.data;
|
||||
},
|
||||
};
|
||||
|
||||
// Contract Tasks (Aufgaben)
|
||||
export const contractTaskApi = {
|
||||
// Alle Tasks über alle Verträge (für Task-Liste & Dashboard)
|
||||
|
||||
Reference in New Issue
Block a user