Update mockDb.ts
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
Condo, Family, Payment, AppSettings, User, AuthResponse,
|
||||
Ticket, TicketComment, ExtraordinaryExpense, Notice,
|
||||
AlertDefinition, NoticeRead
|
||||
AlertDefinition, NoticeRead, CondoExpense
|
||||
} from '../types';
|
||||
|
||||
const API_URL = '/api';
|
||||
@@ -390,5 +390,37 @@ export const CondoService = {
|
||||
|
||||
deleteExpensePayment: async (paymentId: string): Promise<void> => {
|
||||
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}`);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user