Update mockDb.ts

This commit is contained in:
2025-12-11 21:16:58 +01:00
committed by GitHub
parent 45c766a7f9
commit 58fda356c3

View File

@@ -2,7 +2,7 @@
import { import {
Condo, Family, Payment, AppSettings, User, AuthResponse, Condo, Family, Payment, AppSettings, User, AuthResponse,
Ticket, TicketComment, ExtraordinaryExpense, Notice, Ticket, TicketComment, ExtraordinaryExpense, Notice,
AlertDefinition, NoticeRead AlertDefinition, NoticeRead, CondoExpense
} from '../types'; } from '../types';
const API_URL = '/api'; const API_URL = '/api';
@@ -390,5 +390,37 @@ export const CondoService = {
deleteExpensePayment: async (paymentId: string): Promise<void> => { deleteExpensePayment: async (paymentId: string): Promise<void> => {
return request(`/expenses/payments/${paymentId}`, { method: 'DELETE' }); return request(`/expenses/payments/${paymentId}`, { method: 'DELETE' });
},
// --- CONDO EXPENSES (ORDINARY/SUPPLIERS) ---
getCondoExpenses: async (year?: number): Promise<CondoExpense[]> => {
const activeId = CondoService.getActiveCondoId();
let url = `/condo-expenses?condoId=${activeId}`;
if (year) url += `&year=${year}`;
return request<CondoExpense[]>(url);
},
saveCondoExpense: async (expense: Partial<CondoExpense>): Promise<void> => {
const activeId = CondoService.getActiveCondoId();
const payload = { ...expense, condoId: activeId };
if (expense.id) {
return request(`/condo-expenses/${expense.id}`, {
method: 'PUT',
body: JSON.stringify(payload)
});
} else {
return request('/condo-expenses', {
method: 'POST',
body: JSON.stringify(payload)
});
}
},
deleteCondoExpense: async (id: string): Promise<void> => {
return request(`/condo-expenses/${id}`, { method: 'DELETE' });
},
getCondoExpenseAttachment: async (expenseId: string, attId: string): Promise<any> => {
return request(`/condo-expenses/${expenseId}/attachments/${attId}`);
} }
}; };