refactor: Moved business-logic from `ChatRoomService` into `ChatRoom`
authorKai Moritz <kai@juplo.de>
Sun, 8 Jan 2023 20:30:57 +0000 (21:30 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 9 Jan 2023 20:02:13 +0000 (21:02 +0100)
commit40cebae65e5032a71685e7bf647d71597b8a6df3
tree960043bcc4c5ae6bd52789a37632d4e30b22aa75
parent0157815c148d2abc145904eb0a8e91420aecca58
refactor: Moved business-logic from `ChatRoomService` into `ChatRoom`

- Some essential business-logic -- the identification of mutated messages --
  was buried in `InMemoryChatRoomService`.
- This business-logic was moved into `ChatRoom`, becaus otherwise, it
  would have been necessary, to reproduce this logic in each and every
  new implementation of `ChatRoomService`, which would have been exhausting
  and errorprone.
- This allowed also cleaner code in `InMemoryChatRoomService`, that
  can focus on the persistence-logic.
- The implementation of `MessageMutationException` and the look of the
  accompanying problem-details hat to be refined accordingly.
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendController.java
src/main/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerAdvice.java
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoom.java
src/main/java/de/juplo/kafka/chat/backend/domain/ChatRoomService.java
src/main/java/de/juplo/kafka/chat/backend/domain/MessageMutationException.java
src/main/java/de/juplo/kafka/chat/backend/persistence/InMemoryChatRoomService.java
src/test/java/de/juplo/kafka/chat/backend/api/ChatBackendControllerTest.java
src/test/java/de/juplo/kafka/chat/backend/domain/ChatRoomTest.java [new file with mode: 0644]