feat: add treasury audit, attachment download, and installment SMS

Let cheque clearance pick a cash account and export income, expense, and installment lists to Excel.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-18 19:59:24 +03:30
co-authored by Cursor
parent 8981a552fc
commit 96befd3867
11 changed files with 285 additions and 21 deletions
@@ -95,6 +95,35 @@ export class TreasuryController {
return this.treasury.createDocument(user, body);
}
@Get('documents/export')
async exportDocuments(
@CurrentUser() user: Actor,
@Query('kind') kind?: string,
) {
const buffer = await this.treasury.documentsExcel(
user,
kind === 'expense' ? 'expense' : 'income',
);
return new StreamableFile(buffer, {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
disposition: 'attachment; filename="treasury-documents.xlsx"',
});
}
@Get('attachments/:id')
async downloadAttachment(@CurrentUser() user: Actor, @Param('id') id: string) {
const file = await this.treasury.openAttachment(user, id);
return new StreamableFile(file.stream, {
type: file.mimeType,
disposition: `attachment; filename="${encodeURIComponent(file.fileName)}"`,
});
}
@Get('audit')
audit(@CurrentUser() user: Actor) {
return this.treasury.listAudit(user);
}
@Post('documents/:id/attachments')
@UseInterceptors(FileInterceptor('file', { storage: memoryStorage(), limits: { fileSize: 8_000_000 } }))
addAttachment(
@@ -114,6 +143,15 @@ export class TreasuryController {
return this.treasury.settleDocument(user, id, body);
}
@Get('receivables/export')
async exportReceivables(@CurrentUser() user: Actor) {
const buffer = await this.receivables.excel(user);
return new StreamableFile(buffer, {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
disposition: 'attachment; filename="treasury-installments.xlsx"',
});
}
@Get('receivables')
receivablesList(@CurrentUser() user: Actor) {
return this.receivables.list(user);