mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 19:10:22 +01:00
- Move Java backend to backend/ directory - Create frontend/ directory for TypeScript TUI and future WebUI - Update .gitignore for Node.js and worktrees - Update README.md with new repository structure - Copy documentation to backend/
5.1 KiB
5.1 KiB
Quality BC (HACCP/QM) - Detailliertes Domain Model
Bounded Context: Quality Domain Type: CORE Verantwortung: HACCP-Compliance, Qualitätsmanagement, Audit-Vorbereitung
Aggregates
1. TemperatureLog (Aggregate Root)
TemperatureLog
├── TemperatureLogId (VO)
├── MeasurementPoint (VO: COLD_ROOM | FREEZER | DISPLAY_COUNTER | PRODUCTION_ROOM)
├── DeviceId (VO) - Reference to Equipment
├── MeasuredAt (VO: Timestamp)
├── Temperature (VO: with unit °C)
├── MeasuredBy (VO: UserId)
├── CriticalLimitMin (VO)
├── CriticalLimitMax (VO)
└── Status (VO: OK | WARNING | CRITICAL)
Invariants:
- Temperature must be within physically possible range (-50°C to +50°C)
- MeasuredAt cannot be in the future
- Status = CRITICAL if temperature outside critical limits
- Status = WARNING if temperature close to limits (within 10%)
- CriticalLimitMin < CriticalLimitMax
2. CleaningRecord (Aggregate Root)
CleaningRecord
├── CleaningRecordId (VO)
├── Area (VO: PRODUCTION_ROOM | COLD_STORAGE | SALES_COUNTER | EQUIPMENT)
├── CleaningPlanId (VO) - Reference to CleaningPlan
├── ScheduledFor (VO: Date)
├── CompletedAt (VO: Timestamp)
├── CompletedBy (VO: UserId)
├── ChecklistItems[] (Entity)
│ ├── Item (VO: "Floor mopped", "Surfaces disinfected")
│ ├── Checked (VO: boolean)
│ └── Remarks (VO: optional)
└── OverallRemarks (VO)
Invariants:
- All checklist items must be checked to complete
- CompletedAt must be >= ScheduledFor
- Cannot complete without CompletedBy
- Cannot modify after completion
3. GoodsReceiptInspection (Aggregate Root)
GoodsReceiptInspection
├── InspectionId (VO)
├── GoodsReceiptId (VO) - Reference to Procurement BC
├── InspectedAt (VO)
├── InspectedBy (VO: UserId)
├── TemperatureCheck (Entity)
│ ├── MeasuredTemperature (VO)
│ ├── ExpectedRange (VO)
│ └── Status (VO: PASSED | FAILED)
├── VisualInspection (Entity)
│ ├── PackagingIntact (VO: boolean)
│ ├── ColorAppearance (VO: NORMAL | ABNORMAL)
│ ├── SmellTest (VO: NORMAL | ABNORMAL)
│ └── Remarks (VO)
├── MHDCheck (Entity)
│ ├── ExpiryDate (VO)
│ ├── DaysUntilExpiry (VO)
│ ├── MinimumAcceptableDays (VO)
│ └── Status (VO: PASSED | FAILED)
├── DocumentCheck (Entity)
│ ├── DeliveryNoteReceived (VO: boolean)
│ ├── VeterinaryCertificateReceived (VO: boolean)
│ ├── QualityCertificates[] (VO)
│ └── AllDocumentsComplete (VO: boolean)
├── SupplierBatchNumber (VO) - For traceability!
└── FinalResult (VO: ACCEPTED | REJECTED | CONDITIONALLY_ACCEPTED)
Invariants:
- All checks must be performed before FinalResult can be set
- If REJECTED, OverallRemarks must be provided
- Temperature must be within acceptable range for ACCEPTED
- MHD must have minimum days for ACCEPTED
- VeterinaryCertificate required for meat products
4. TrainingRecord (Aggregate Root)
TrainingRecord
├── TrainingRecordId (VO)
├── EmployeeId (VO: UserId)
├── TrainingType (VO: HACCP | HYGIENE | FOOD_SAFETY | EQUIPMENT_OPERATION)
├── TrainingDate (VO)
├── ValidUntil (VO) - Auffrischung notwendig
├── Trainer (VO) - Internal or external
├── CertificateNumber (VO)
├── CertificateDocumentUrl (VO)
└── Status (VO: VALID | EXPIRED | REVOKED)
Invariants:
- ValidUntil must be after TrainingDate
- Status = EXPIRED if ValidUntil < TODAY
- Cannot revoke without reason
5. MaintenanceRecord (Aggregate Root)
MaintenanceRecord
├── MaintenanceRecordId (VO)
├── EquipmentId (VO)
├── MaintenanceType (VO: SCHEDULED | REPAIR | INSPECTION)
├── ScheduledFor (VO: Date)
├── PerformedAt (VO: Timestamp)
├── PerformedBy (VO) - Internal staff or external company
├── Findings (VO)
├── Actions (VO)
├── NextMaintenanceDue (VO: Date)
└── Status (VO: COMPLETED | PENDING | FAILED)
Invariants:
- PerformedAt must be >= ScheduledFor
- If FAILED, Findings and Actions must be documented
- NextMaintenanceDue must be calculated based on maintenance interval
Repository Interfaces
public interface TemperatureLogRepository {
Result<RepositoryError, Void> save(TemperatureLog log);
Result<RepositoryError, List<TemperatureLog>> findByPeriod(
LocalDate from, LocalDate to
);
Result<RepositoryError, List<TemperatureLog>> findCritical();
}
public interface GoodsReceiptInspectionRepository {
Result<RepositoryError, Void> save(GoodsReceiptInspection inspection);
Result<RepositoryError, GoodsReceiptInspection> findByGoodsReceiptId(
GoodsReceiptId id
);
}
Domain Events
TemperatureCriticalLimitExceeded(TemperatureLogId, MeasurementPoint, Temperature)
CleaningOverdue(CleaningPlanId, Area, LocalDate scheduledFor)
GoodsReceiptRejected(InspectionId, GoodsReceiptId, String reason)
TrainingExpiringSoon(TrainingRecordId, UserId, LocalDate expiryDate)
MaintenanceOverdue(EquipmentId, LocalDate scheduledFor)