summaryrefslogtreecommitdiff
path: root/10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml
diff options
context:
space:
mode:
Diffstat (limited to '10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml')
-rw-r--r--10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml38
1 files changed, 38 insertions, 0 deletions
diff --git a/10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml b/10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml
new file mode 100644
index 0000000..d3dac57
--- /dev/null
+++ b/10-entwurfsheft/assets/diagrams/sequencediagram-uploadEpisodeActions.puml
@@ -0,0 +1,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 \ No newline at end of file