feat: Jahresbericht-PDF pro Volk/Stand

Neue PDF-Reports im Export-Modul: colony-annual-report (Durchsichten,
Behandlungen, Varroakontrollen, Schwarmkontrolle, Ernten eines Volkes fuer
ein Jahr) und apiary-annual-report (Voelker-Uebersicht + Ernten eines
Stands fuer ein Jahr). Jahr ist optional, faellt auf das aktuelle Jahr
zurueck.

Frontend: "Jahresbericht"-Button auf Volk- und Stand-Detailseite, laedt
das PDF ueber den bestehenden Blob-Download-Mechanismus herunter.
This commit is contained in:
Nick Szaunig committed 2026-08-25 11:51:41 +02:00
1 parent f1298eff08
commit 3f7c4ed404
8 files changed
+630 -26

No files matched your search

+43
View File
@@ -131,4 +131,47 @@ describe('Export (e2e)', () => {
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(400);
});
it('rejects the colony annual report without a colonyId', () => {
return request(app.getHttpServer())
.get('/api/v1/export/colony-annual-report.pdf')
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(400);
});
it('rejects the colony annual report for an unknown colony', () => {
return request(app.getHttpServer())
.get('/api/v1/export/colony-annual-report.pdf?colonyId=does-not-exist')
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(404);
});
it('renders a colony annual report PDF', async () => {
const response = await request(app.getHttpServer())
.get(`/api/v1/export/colony-annual-report.pdf?colonyId=${colonyId}`)
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(200);
expect(response.headers['content-type']).toContain('application/pdf');
expect((response.body as Buffer).subarray(0, 4).toString('latin1')).toBe(
'%PDF',
);
});
it('rejects the apiary annual report without an apiaryId', () => {
return request(app.getHttpServer())
.get('/api/v1/export/apiary-annual-report.pdf')
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(400);
});
it('renders an apiary annual report PDF', async () => {
const response = await request(app.getHttpServer())
.get(`/api/v1/export/apiary-annual-report.pdf?apiaryId=${apiaryId}`)
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(200);
expect(response.headers['content-type']).toContain('application/pdf');
expect((response.body as Buffer).subarray(0, 4).toString('latin1')).toBe(
'%PDF',
);
});
});