diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java index f3a3fd2b..21e1cc2e 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java @@ -32,6 +32,9 @@ public interface DocumentDao { @Query("SELECT * FROM Document WHERE parent_id = :parentId") List findByParentId(String parentId); + @Query("SELECT * FROM Document WHERE parent_id IS NULL") + List findRootDocuments(); + @Query("SELECT * FROM Document ORDER BY created_at DESC LIMIT :limit") List getRecentDocument(int limit); diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java index af5e92d4..404b53f8 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/FolderDao.java @@ -18,6 +18,9 @@ public interface FolderDao { @Query("SELECT * FROM Folder WHERE parent_id = :parentId") List findByParentId(String parentId); + @Query("SELECT * FROM Folder WHERE parent_id IS NULL") + List findRootFolders(); + @Insert void insert(FolderEntity folderEntity);