feat: T6 wave 2 – medicine book, document rights, label particulars, herd events
Backend Image / build-and-push (push) Successful in 6m34s
Frontend Image / build-and-push (push) Successful in 10m17s

- Veterinary medicine catalogue, lots and append-only movement ledger
  (rest always computed; corrections as counter-bookings; inactive
  medicines take no new stock; unit must match on lot moves).
- Documents of medicine lots, authority notices and restrictions need the
  domain right on top of documents:* (403 before any lookup).
- Label particulars: pure checkLabel with six mandatory gaps and four
  warnings, AFM font metrics, Berlin-day dates, geometric reading order
  for split addresses, new master-data fields with row-locked updates.
- Herd events ColonyCreated, ColonyMoved, ApiaryChanged and
  TskReferenceDayReached (ids only, never forwarded to webhooks); CSV
  import emits ColonyCreated with audit.
- ARCHITECTURE.md §12 Compliance (T6), Annahmen 59–70.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-15 13:43:44 +02:00
1 parent 8a31c42578
commit c18860c75c
73 files changed
+7121 -309

No files matched your search

@@ -8,6 +8,8 @@ import { PrismaService } from '../prisma/prisma.service';
import { AuditLogService } from '../audit/audit-log.service';
import { WebhooksService } from '../webhooks/webhooks.service';
import { DomainEventsService } from '../domain-events/domain-events.service';
import type { AnyNewDomainEvent } from '../domain-events/domain-event-types';
import { colonyCreatedEvent } from './colony-created-event';
import { Colony, ColonyStatus, Prisma } from '../../generated/prisma';
import { CreateColonyDto } from './dto/create-colony.dto';
import { UpdateColonyDto } from './dto/update-colony.dto';
@@ -23,6 +25,21 @@ import { lockRowsForUpdate } from '../prisma/row-lock';
import { colonyTransitionEvents, lockColony } from './colony-events';
import { berlinToday, dayToDate } from '../common/dates';
function colonyMovedEvent(
colonyId: string,
fromApiaryId: string,
toApiaryId: string,
actorUserId: string,
): AnyNewDomainEvent<'ColonyMoved'> {
return {
type: 'ColonyMoved',
aggregateType: 'Colony',
aggregateId: colonyId,
actorUserId,
payload: { fromApiaryId, toApiaryId },
};
}
export interface ColonyFilter {
status?: ColonyStatus;
apiaryId?: string;
@@ -96,10 +113,10 @@ export class ColoniesService {
},
tx,
);
await this.events.record(tx, colonyCreatedEvent(created, actingUserId));
return created;
});
// No domain event for a new colony in this stage - the webhook stays on
// the direct path.
// The webhook stays on the direct path (the event is not forwarded).
await this.webhooks.dispatch('colony.created', colony);
return colony;
}
@@ -159,6 +176,10 @@ export class ColoniesService {
notes: 'Korrektur über Volk bearbeiten',
},
});
await this.events.record(
tx,
colonyMovedEvent(id, before.apiaryId, updated.apiaryId, actingUserId),
);
}
await this.events.recordAll(
tx,
@@ -204,6 +225,12 @@ export class ColoniesService {
notes: dto.notes,
},
});
if (before.apiaryId !== updated.apiaryId) {
await this.events.record(
tx,
colonyMovedEvent(id, before.apiaryId, updated.apiaryId, actingUserId),
);
}
await this.auditLog.record(
{
entityType: 'Colony',
@@ -263,6 +290,7 @@ export class ColoniesService {
},
tx,
);
await this.events.record(tx, colonyCreatedEvent(created, actingUserId));
await this.events.record(tx, {
type: 'ColonySplit',
aggregateType: 'Colony',