Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
문서 groups 타입 변경
Browse files Browse the repository at this point in the history
List<?> -> List<List<?>>
  • Loading branch information
ori0o0p committed Feb 25, 2024
1 parent ee40e56 commit 7f74581
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Objects;

@Component
public class CreateDocumentFacade {
Expand Down Expand Up @@ -39,10 +38,7 @@ public DefaultDocument execute(SaveDocumentRequest request, User user) {
.updatedUser(userDetail)
.build())
.content(request.content())
.groups(request.groups().stream()
.filter(Objects::nonNull)
.map(group -> String.join("/", group))
.toList())
.groups(request.groups())
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

import java.util.List;
import java.util.Objects;

@Service
Expand All @@ -36,11 +35,6 @@ public UpdateDocument(DocumentFacade documentFacade, UserFacade userFacade, Docu
public Mono<Void> execute(SaveDocumentRequest request, String documentId) {
return userFacade.currentUser()
.zipWith(documentFacade.findDocumentById(documentId), (user, document) -> {
List<String> groups = request.groups().stream()
.filter(Objects::nonNull)
.map(group -> String.join("/", group))
.toList();

document.getEditor().update(UserDetailResponse.builder()
.id(user.getId())
.name(user.getName())
Expand All @@ -50,7 +44,7 @@ public Mono<Void> execute(SaveDocumentRequest request, String documentId) {
document.update(request.title(),
getDocumentType.execute(request.type()),
request.content(),
groups);
request.groups());

return document;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DefaultDocument {

private EditDateTime dateTime;

private List<String> groups;
private List<List<String>> groups;

private DocumentEditor editor;

Expand All @@ -35,7 +35,7 @@ public class DefaultDocument {
private Integer version;

@Builder
public DefaultDocument(String title, DocumentType type, EditDateTime dateTime, List<String> groups, DocumentEditor documentEditor, String content) {
public DefaultDocument(String title, DocumentType type, EditDateTime dateTime, List<List<String>> groups, DocumentEditor documentEditor, String content) {
this.title = title;
this.type = type;
this.dateTime = dateTime;
Expand All @@ -44,7 +44,7 @@ public DefaultDocument(String title, DocumentType type, EditDateTime dateTime, L
this.content = content;
}

public void update(String title, DocumentType type, String content, List<String> groups) {
public void update(String title, DocumentType type, String content, List<List<String>> groups) {
this.title = title;
this.type = type;
this.content = content;
Expand Down

0 comments on commit 7f74581

Please sign in to comment.