Files
familienarchiv/docs/architecture/c4/seq-document-upload.puml

33 lines
1.1 KiB
Plaintext

@startuml
title Document Upload Flow
actor User
participant "Frontend (SvelteKit)" as Frontend
participant "Backend (Spring Boot)" as Backend
participant "PermissionAspect (AOP)" as Aspect
participant DocumentService as DocSvc
participant FileService as FileSvc
participant MinIO
participant PostgreSQL as DB
User -> Frontend: Submit edit form (file + metadata)
Frontend -> Backend: PUT /api/documents/{id}\nmultipart/form-data + Authorization header
Backend -> Aspect: @RequirePermission(WRITE_ALL) check
Aspect -> Aspect: Verify user has WRITE_ALL authority
Aspect --> Backend: Proceed
Backend -> DocSvc: updateDocument(id, dto, file)
DocSvc -> DocSvc: Resolve sender Person by ID
DocSvc -> DocSvc: Resolve/create Tags
DocSvc -> FileSvc: uploadFile(file, filename)
FileSvc -> FileSvc: Generate key: documents/{UUID}_{filename}
FileSvc -> MinIO: PutObject(bucket, key, stream)
MinIO --> FileSvc: Success
FileSvc --> DocSvc: S3 key
DocSvc -> DB: UPDATE documents SET file_path=?, status='UPLOADED', ...
DB --> DocSvc: OK
DocSvc --> Backend: Updated Document entity
Backend --> Frontend: 200 OK — Document JSON
Frontend --> User: Refreshed document view
@enduml