Diagramme listes - 0x485254/brief-26 GitHub Wiki

sequenceDiagram
    participant Frontend
    participant ListShareController
    participant ListShareService
    participant ListRepository
    participant ListShareRepository
    participant UserRepository

    Frontend->>ListShareController: POST /lists/{id}/share/{userId}
    ListShareController->>ListShareService: shareList(id, userId)
    ListShareService->>ListRepository: findById(id)
    ListShareService->>UserRepository: findById(userId)
    ListShareService->>ListShareRepository: existsByListAndSharedWith()
    alt Non existant
        ListShareService->>ListShareRepository: save(ListShare)
    else Déjà partagé
        ListShareService-->>ListShareController: throw ConflictException
    end
    ListShareController-->>Frontend: 200 OK