Mocka: AttachmentRepository, FileStorageService, MedicalRecordRepository, AttachmentPolicy, MedicalRecordPolicy, AwsS3Properties
uploadAttachment:
- Tom fil → IllegalArgumentException
- Journal finns inte → ResourceNotFoundException
- S3-uppladdning misslyckas → RuntimeException + ingen DB-post sparas
- DB-sparning misslyckas → RuntimeException + S3-cleanup anropas
- Lyckas → returnerar AttachmentResponse
getAttachment:
- Hittar bilaga → anropar canDownload och returnerar AttachmentResponse
- Finns inte → ResourceNotFoundException
deleteAttachment:
- Hittar bilaga → anropar canDelete och attachmentRepository.delete
- Finns inte → ResourceNotFoundException
getAttachmentsByRecord:
- Journal finns → anropar canView och returnerar lista
- Journal finns inte → ResourceNotFoundException
Mocka: AttachmentRepository, FileStorageService, MedicalRecordRepository, AttachmentPolicy, MedicalRecordPolicy, AwsS3Properties
uploadAttachment:
getAttachment:
deleteAttachment:
getAttachmentsByRecord: