Update mockDb.ts

This commit is contained in:
2025-12-12 00:20:12 +01:00
committed by GitHub
parent 52c81d6e15
commit f50edc730d

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, CondoExpense AlertDefinition, NoticeRead, CondoExpense, Document
} from '../types'; } from '../types';
const API_URL = '/api'; const API_URL = '/api';
@@ -422,5 +422,28 @@ export const CondoService = {
getCondoExpenseAttachment: async (expenseId: string, attId: string): Promise<any> => { getCondoExpenseAttachment: async (expenseId: string, attId: string): Promise<any> => {
return request(`/condo-expenses/${expenseId}/attachments/${attId}`); return request(`/condo-expenses/${expenseId}/attachments/${attId}`);
},
// --- DOCUMENTS ---
getDocuments: async (): Promise<Document[]> => {
const activeId = CondoService.getActiveCondoId();
return request<Document[]>(`/documents?condoId=${activeId}`);
},
uploadDocument: async (doc: any): Promise<void> => {
const activeId = CondoService.getActiveCondoId();
const settings = await CondoService.getSettings();
return request('/documents', {
method: 'POST',
body: JSON.stringify({ ...doc, condoId: activeId, storageConfig: settings.storageConfig })
});
},
deleteDocument: async (id: string): Promise<void> => {
return request(`/documents/${id}`, { method: 'DELETE' });
},
getDocumentDownload: async (id: string): Promise<{fileName: string, fileType: string, data: string}> => {
return request(`/documents/${id}/download`);
} }
}; };