feat: T4 wave 3 - notifications per user, suggestions API, varroa bands, split/queen events

- Schema III: per-user notifications (broadcast fan-out migration,
  category, link, requiredPermissions filter), notification preferences
  and settings endpoints, calendar withdrawal switch, occupiedFrames
- Suggestions API: list/summary with permission visibility and paging,
  accept/dismiss/reopen incl. bulk, SuggestionView on all responses
- Varroa traffic light by season and method, young colonies, treatment
  effect window, sample-based percentage; shared withdrawal-window helper
  on Berlin calendar days; GET /varroa-measurements/thresholds
- ColonySplit and QueenAssigned domain events with calendar and webhook
  handlers
- Outbox claims compare against now() rounded to timestamp(3); fixes the
  flaky e2e claims of rows written with SQL now()

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-14 14:25:24 +02:00
1 parent d99a697739
commit f468dc5f75
87 files changed
+6022 -510

No files matched your search

@@ -44,6 +44,7 @@ describe('Calendar sync outbox (e2e)', () => {
syncFeeding: true,
syncHarvest: true,
syncQueenAssignment: true,
syncWithdrawal: true,
updatedAt: new Date(),
};
@@ -359,6 +360,37 @@ describe('Calendar sync outbox (e2e)', () => {
expect(JSON.stringify(response.body)).toContain('Gruppen-ID');
});
// GET /settings is mocked in this file (see beforeEach), so the stored
// row is read directly.
it('syncWithdrawal is on by default and can be switched off', async () => {
const fresh = await prisma.calendarSyncSettings.create({
data: { id: `default-check-${suffix}` },
});
await prisma.calendarSyncSettings.delete({ where: { id: fresh.id } });
expect(fresh.syncWithdrawal).toBe(true);
await prisma.calendarSyncSettings.upsert({
where: { id: 'singleton' },
create: { id: 'singleton' },
update: {},
});
const response = await request(app.getHttpServer())
.patch('/api/v1/calendar/sync/settings')
.set(auth())
.send({ syncWithdrawal: false })
.expect(200);
expect(response.body).toMatchObject({ syncWithdrawal: false });
const stored = await prisma.calendarSyncSettings.findUniqueOrThrow({
where: { id: 'singleton' },
});
expect(stored.syncWithdrawal).toBe(false);
await prisma.calendarSyncSettings.update({
where: { id: 'singleton' },
data: { syncWithdrawal: true },
});
});
// PATCH null rule: the switches cannot hold null - 400, not a 500.
it('rejects null on a switch with 400', async () => {
await request(app.getHttpServer())