moveDocumentを定義, 実装

This commit is contained in:
ろむねこ 2024-01-25 15:01:18 +09:00
parent d5ebc2c498
commit 44edd1c23e
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168
2 changed files with 15 additions and 0 deletions

View File

@ -23,6 +23,8 @@ public interface Document {
CompletableFuture<Void> deleteDocument(String documentId);
CompletableFuture<Void> moveDocument(String documentId, String parentId);
CompletableFuture<Void> updateDocument(DocumentDetail detail);
CompletableFuture<DocumentDetail> getDocument(String documentId);

View File

@ -123,6 +123,19 @@ public class DocumentImpl implements Document {
});
}
@Override
public CompletableFuture<Void> moveDocument(String documentId, String parentId) {
return CompletableFuture.supplyAsync(() -> {
DocumentEntity documentEntity = database.documentDao().findById(documentId);
if (documentEntity == null) {
throw new IllegalArgumentException("documentId is not found");
}
documentEntity.parentId = parentId;
database.documentDao().update(documentEntity);
return null;
});
}
@Override
public CompletableFuture<Void> updateDocument(DocumentDetail detail) {
return CompletableFuture.supplyAsync(() -> {