summaryrefslogtreecommitdiff
path: root/11-entwurfsheft-kolloquium/assets/diagrams/sequencediagram-uploadEpisodeActions.puml
blob: d3dac57d53a4b52014955a1b082bb11e68f8bc2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@startuml

' title =**Upload Episode Actions**

participant EpisodeActionController << (C, #ADD1B2) @Controller >>
-> EpisodeActionController: ""POST /api/2/episodes/{username}.json"" \n//@RequestBody EpisodeActionPostRequest episodeActionPostRequest// \n\n-> addEpisodeActions(""username"", //episodeActionPostRequest//)
activate EpisodeActionController
participant EpisodeActionService << (C, #ADD1B2) @Service >>
EpisodeActionController -> EpisodeActionService: addEpisodeActions(""username"", \nepisodeActionPosts = //episodeActionPostRequest//.getEpisodeActionPosts())
activate EpisodeActionService
participant EpisodeActionDataAccessService << (C, #ADD1B2) @Repository >>
EpisodeActionService -> EpisodeActionDataAccessService: addEpisodeActions(""username"", episodeActionPosts)
database Database
activate EpisodeActionDataAccessService
loop for each EpisodeActionPost in episodeActionPosts -> episodeAction = episodeActionPost.getEpisodeAction()
opt episodeAction.getAction().equals(Action.PLAY)
EpisodeActionDataAccessService -> Database: set episodeID field of episodeAction for this ""username"" via podcastURL and episodeURL
activate Database
Database --> EpisodeActionDataAccessService
EpisodeActionDataAccessService -> Database: get last EpisodeAction with this episodeID if present
Database --> EpisodeActionDataAccessService: Optional<EpisodeAction> lastEpisodeAction
opt lastEpisodeAction.isPresent()
EpisodeActionDataAccessService -> Database: replace lastEpisodeAction with episodeAction
else else
EpisodeActionDataAccessService -> Database: add episodeAction to DB as new entry
end
Database --> EpisodeActionDataAccessService
deactivate Database
end
end
EpisodeActionDataAccessService --> EpisodeActionService: long latestTimestamp
deactivate EpisodeActionDataAccessService
EpisodeActionService --> EpisodeActionController: LocalDateTime timestamp = LocalDateTime.ofEpochSecond(latestTimestamp, 0, ZoneOffset.UTC)
deactivate EpisodeActionService
<-- EpisodeActionController: ResponseEntity<EpisodeActionPostResponse> \n(with empty list for updateURLs) \n\n-> ""HTTP status code"" \n-> ""JSON""
deactivate EpisodeActionController

@enduml