diff --git a/src/main/java/com/example/daemawiki/domain/content/service/AddContentTable.java b/src/main/java/com/example/daemawiki/domain/content/service/AddContentTable.java index 8995adaf..98f2f989 100644 --- a/src/main/java/com/example/daemawiki/domain/content/service/AddContentTable.java +++ b/src/main/java/com/example/daemawiki/domain/content/service/AddContentTable.java @@ -41,14 +41,14 @@ public AddContentTable(DocumentFacade documentFacade, RevisionComponent revision public Mono execute(AddContentRequest request, String documentId) { return userFacade.currentUser() .zipWith(documentFacade.findDocumentById(documentId)) - .flatMap(tuple -> checkUserPermissionAndVersion(tuple, request.version())) - .flatMap(tuple -> addDocumentContentTable(tuple, request)) + .map(tuple -> checkUserPermissionAndVersion(tuple, request.version())) + .map(tuple -> addDocumentContentTable(tuple, request)) .flatMap(document -> documentFacade.saveDocument(document) .then(createRevision(document))) .onErrorMap(this::mapException); } - private Mono addDocumentContentTable(Tuple2 tuple, AddContentRequest request) { + private DefaultDocument addDocumentContentTable(Tuple2 tuple, AddContentRequest request) { DefaultDocument document = tuple.getT2(); User user = tuple.getT1(); @@ -56,12 +56,12 @@ private Mono addDocumentContentTable(Tuple2> checkUserPermissionAndVersion(Tuple2 tuple, int version) { + private Tuple2 checkUserPermissionAndVersion(Tuple2 tuple, int version) { userFilter.userPermissionAndDocumentVersionCheck(tuple.getT2(), tuple.getT1().getEmail(), version); - return Mono.just(tuple); + return tuple; } private void setDocumentContent(DefaultDocument document, String index, String title) {