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

+38
View File
@@ -30,6 +30,15 @@ describe('Apiaries (e2e)', () => {
let noColonyToken: string;
let fieldApiaryId: string;
// The ApiaryChanged codes of one apiary, oldest first.
async function changesOf(id: string): Promise<string[]> {
const events = await prisma.domainEvent.findMany({
where: { type: 'ApiaryChanged', aggregateId: id },
orderBy: { occurredAt: 'asc' },
});
return events.map((event) => (event.payload as { change: string }).change);
}
beforeAll(async () => {
app = await createTestApp();
prisma = app.get(PrismaService);
@@ -85,6 +94,12 @@ describe('Apiaries (e2e)', () => {
});
afterAll(async () => {
await prisma.domainEvent.deleteMany({
where: {
aggregateType: 'Apiary',
aggregateId: { in: [apiaryId, fieldApiaryId].filter(Boolean) },
},
});
if (fieldApiaryId) {
await prisma.task.deleteMany({
where: { title: { startsWith: 'field-e2e-' } },
@@ -154,6 +169,7 @@ describe('Apiaries (e2e)', () => {
.send({ notes: 'aktualisiert' })
.expect(200);
expect((updated.body as ApiaryBody).notes).toBe('aktualisiert');
expect(await changesOf(apiaryId)).toEqual(['CREATED']);
const deactivated = await request(app.getHttpServer())
.post(`/api/v1/apiaries/${apiaryId}/deactivate`)
@@ -166,6 +182,11 @@ describe('Apiaries (e2e)', () => {
.set('Authorization', `Bearer ${beekeeperToken}`)
.expect(201);
expect((reactivated.body as ApiaryBody).status).toBe('ACTIVE');
expect(await changesOf(apiaryId)).toEqual([
'CREATED',
'DEACTIVATED',
'REACTIVATED',
]);
await request(app.getHttpServer())
.post(`/api/v1/apiaries/${apiaryId}/reactivate`)
@@ -173,6 +194,23 @@ describe('Apiaries (e2e)', () => {
.expect(409);
});
it('updating only the name of an apiary leaves no ApiaryChanged', async () => {
const before = await changesOf(apiaryId);
await request(app.getHttpServer())
.patch(`/api/v1/apiaries/${apiaryId}`)
.set('Authorization', `Bearer ${beekeeperToken}`)
.send({ name: 'Heimstand umbenannt' })
.expect(200);
expect(await changesOf(apiaryId)).toEqual(before);
await request(app.getHttpServer())
.patch(`/api/v1/apiaries/${apiaryId}`)
.set('Authorization', `Bearer ${beekeeperToken}`)
.send({ address: 'Neuer Weg 3' })
.expect(200);
expect(await changesOf(apiaryId)).toEqual([...before, 'LOCATION_CHANGED']);
});
it('lets publicLocationLabel be set, changed and cleared with null', async () => {
const patch = (body: object) =>
request(app.getHttpServer())