監査記録の課題を解決します。診察開始の記録には、必要な項目だけを残します。
examples/session-03/src/adaptor/secondary/sqlite/appointmentRepository.ts:92-96 payload: {
...payload,
appointment,
ownerContact: ownerContactFor(appointment.appointmentId),
}, 監査記録 1件
- appointment予約の全項目
- ownerNameOwner A
- ownerEmailowner@example.test
- ownerPhone090-0000-0000
examples/session-03-solution/src/adaptor/secondary/sqlite/auditPayload.ts:13-19 export const toAuditPayload = (
appointment: InExamination,
): ExaminationStartedAuditPayload => ({
appointmentId: appointment.appointmentId,
veterinarianId: appointment.veterinarianId,
examinationStartedAt: appointment.examinationStartedAt,
}); 監査記録 1件
- appointmentIdどの予約か
- veterinarianId誰が
- examinationStartedAtいつ
- appointment・ownerContact残さない
-
修正後のコードは、3項目だけを記録に含めます。appendExaminationStartedAudit が toAuditPayload を呼びます。
-
個人情報と appointment の全項目を残さなくても、「誰が」「いつ」診察を開始したかは確認できます。