CreateFolder改修

This commit is contained in:
ろむねこ 2024-01-22 20:23:36 +09:00
parent da8d4fb4fc
commit 68fb0b719b
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -124,19 +124,10 @@ public class LacertaLibraryImpl implements LacertaLibrary {
@Override
public CompletableFuture<String> createFolder(String parentId, String name) {
return CompletableFuture.supplyAsync(() -> {
FolderEntity parentFolderEntity = database.folderDao().findById(parentId);
PublicPath publicPath;
if (parentFolderEntity == null) {
publicPath = new PublicPath().resolve("/");
} else {
publicPath = new PublicPath().resolve(parentFolderEntity.publicPath);
}
FolderEntity folderEntity = new FolderEntity();
folderEntity.id = UUID.randomUUID().toString();
folderEntity.name = name;
folderEntity.publicPath = publicPath.getStringPath();
folderEntity.parentId = parentId;
database.folderDao().insert(folderEntity);
return folderEntity.id;
});