feat: T6 wave 3 – treatment books from lot, label print lock, restricted zone, authority notices
Backend Image / build-and-push (push) Successful in 5m13s
Frontend Image / build-and-push (push) Successful in 8m54s

- Treatments book their dose from a medicine lot (delta booking on edit,
  bulk all-or-nothing, idempotent); Bestandsbuch columns from the lot,
  FEHLT exactly where treatmentLogGaps reports a gap; Bestandsbuch export
  needs veterinary-medicines:read.
- Label printing: 409 LABEL_PARTICULARS_MISSING on gaps, proof print with
  watermark, PRINT audit before the PDF, check endpoints; digit rules only
  from the seeded ComplianceSettings row (fail closed).
- Restricted zone (Berlin day): create, update, move, merge and CSV import
  blocked inside an active restriction; override with reason and
  compliance:manage, audited, never stored on the colony; split, harvest
  and dissolve stay free; restriction details only with compliance:read.
- Authority notices: settings, herd snapshot, registration/herd change/TSK
  notices with one open draft per kind under the settings lock.
- Label check refinements (geometric reading order, number|unit pairs).
- ARCHITECTURE.md §12.6–12.8, Annahmen 71–77; spec §5.6 Berlin day.

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 14:18:41 +02:00
1 parent c18860c75c
commit edc193f128
73 files changed
+9470 -171

No files matched your search

@@ -1,6 +1,7 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsEnum, IsInt, IsOptional, IsString, Max, Min } from 'class-validator';
import { ColonyCondition, ColonyType } from '../../../generated/prisma';
import { RestrictionOverrideReason } from './restriction-override-reason';
export class CreateColonyDto {
@ApiProperty()
@@ -67,4 +68,7 @@ export class CreateColonyDto {
@IsOptional()
@IsString()
notes?: string;
@RestrictionOverrideReason()
restrictionOverrideReason?: string | null;
}
@@ -1,5 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { ArrayMinSize, IsArray, IsOptional, IsString } from 'class-validator';
import { RestrictionOverrideReason } from './restriction-override-reason';
export class MergeColonyDto {
@ApiProperty({ type: [String] })
@@ -12,4 +13,7 @@ export class MergeColonyDto {
@IsOptional()
@IsString()
notes?: string;
@RestrictionOverrideReason()
restrictionOverrideReason?: string | null;
}
@@ -1,5 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsOptional, IsString } from 'class-validator';
import { RestrictionOverrideReason } from './restriction-override-reason';
export class MoveColonyDto {
@ApiProperty()
@@ -10,4 +11,7 @@ export class MoveColonyDto {
@IsOptional()
@IsString()
notes?: string;
@RestrictionOverrideReason()
restrictionOverrideReason?: string | null;
}
@@ -0,0 +1,32 @@
import { applyDecorators } from '@nestjs/common';
import { ApiPropertyOptional } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsOptional, IsString, MaxLength, MinLength } from 'class-validator';
export const OVERRIDE_REASON_MIN = 10;
export const OVERRIDE_REASON_MAX = 500;
/**
* `restrictionOverrideReason`: why a colony may enter or leave an apiary in a
* restricted zone. Only read by ColoniesService (needs compliance:manage) and
* written to audit and apiary history - never to the colony. Trimmed before
* the length check, so blanks do not count; null counts as omitted.
*/
export function RestrictionOverrideReason(): PropertyDecorator {
return applyDecorators(
ApiPropertyOptional({
nullable: true,
minLength: OVERRIDE_REASON_MIN,
maxLength: OVERRIDE_REASON_MAX,
description:
'Begründung für eine Ausnahme vom Sperrbezirk (nur mit compliance:manage)',
}),
IsOptional(),
Transform(({ value }: { value: unknown }) =>
typeof value === 'string' ? value.trim() : value,
),
IsString(),
MinLength(OVERRIDE_REASON_MIN),
MaxLength(OVERRIDE_REASON_MAX),
);
}
@@ -3,6 +3,7 @@ import { IsEnum } from 'class-validator';
import { ColonyStatus } from '../../../generated/prisma';
import { CreateColonyDto } from './create-colony.dto';
import { IsOptionalNotNull } from '../../common/validation/is-optional-not-null';
import { RestrictionOverrideReason } from './restriction-override-reason';
/**
* `apiaryId` is editable here too, not only through POST /colonies/:id/move:
@@ -32,4 +33,7 @@ export class UpdateColonyDto extends UpdatableColonyFieldsDto {
@IsOptionalNotNull()
@IsEnum(ColonyStatus)
status?: ColonyStatus;
@RestrictionOverrideReason()
restrictionOverrideReason?: string | null;
}