From f50edc730d05d15707254d1095499ab6ec6598d3 Mon Sep 17 00:00:00 2001 From: frakarr Date: Fri, 12 Dec 2025 00:20:12 +0100 Subject: [PATCH] Update mockDb.ts --- services/mockDb.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/services/mockDb.ts b/services/mockDb.ts index 92d2e25..38722d0 100644 --- a/services/mockDb.ts +++ b/services/mockDb.ts @@ -2,7 +2,7 @@ import { Condo, Family, Payment, AppSettings, User, AuthResponse, Ticket, TicketComment, ExtraordinaryExpense, Notice, - AlertDefinition, NoticeRead, CondoExpense + AlertDefinition, NoticeRead, CondoExpense, Document } from '../types'; const API_URL = '/api'; @@ -422,5 +422,28 @@ export const CondoService = { getCondoExpenseAttachment: async (expenseId: string, attId: string): Promise => { return request(`/condo-expenses/${expenseId}/attachments/${attId}`); + }, + + // --- DOCUMENTS --- + getDocuments: async (): Promise => { + const activeId = CondoService.getActiveCondoId(); + return request(`/documents?condoId=${activeId}`); + }, + + uploadDocument: async (doc: any): Promise => { + 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 => { + return request(`/documents/${id}`, { method: 'DELETE' }); + }, + + getDocumentDownload: async (id: string): Promise<{fileName: string, fileType: string, data: string}> => { + return request(`/documents/${id}/download`); } };