feat: T6 wave 2 – medicine book, document rights, label particulars, herd events
- 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:
1 parent
8a31c42578
commit
c18860c75c
73 files changed
+7121
-309
No files matched your search
@@ -70,6 +70,15 @@ describe('Import (e2e)', () => {
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
const colonyIds = (
|
||||
await prisma.colony.findMany({
|
||||
where: { apiaryId },
|
||||
select: { id: true },
|
||||
})
|
||||
).map((colony) => colony.id);
|
||||
await prisma.domainEvent.deleteMany({
|
||||
where: { aggregateType: 'Colony', aggregateId: { in: colonyIds } },
|
||||
});
|
||||
await prisma.colony.deleteMany({ where: { apiaryId } });
|
||||
await prisma.apiary.deleteMany({ where: { id: apiaryId } });
|
||||
await prisma.apiary.deleteMany({
|
||||
@@ -143,6 +152,13 @@ describe('Import (e2e)', () => {
|
||||
const firstReport = firstResponse.body as ImportReportBody;
|
||||
expect(firstReport.created).toBe(1);
|
||||
|
||||
const colony = await prisma.colony.findUniqueOrThrow({ where: { code } });
|
||||
const events = await prisma.domainEvent.findMany({
|
||||
where: { type: 'ColonyCreated', aggregateId: colony.id },
|
||||
});
|
||||
expect(events).toHaveLength(1);
|
||||
expect(events[0].payload).toEqual({ apiaryId });
|
||||
|
||||
const secondResponse = await request(app.getHttpServer())
|
||||
.post('/api/v1/import/colonies')
|
||||
.set('Authorization', `Bearer ${adminToken}`)
|
||||
@@ -154,6 +170,12 @@ describe('Import (e2e)', () => {
|
||||
const secondReport = secondResponse.body as ImportReportBody;
|
||||
expect(secondReport.created).toBe(0);
|
||||
expect(secondReport.skipped).toBe(1);
|
||||
// The skipped re-import leaves no second event.
|
||||
expect(
|
||||
await prisma.domainEvent.count({
|
||||
where: { type: 'ColonyCreated', aggregateId: colony.id },
|
||||
}),
|
||||
).toBe(1);
|
||||
});
|
||||
|
||||
it('reports an error when the referenced apiary is unknown', async () => {
|
||||
|
||||
Reference in new issue
Block a user