Fix GetFoldersWithFeeds tests...

This commit is contained in:
Shinokuni 2024-04-27 21:20:35 +02:00
parent 9f87077945
commit 2c105f596a
2 changed files with 14 additions and 7 deletions

View File

@ -30,7 +30,6 @@ class GetFoldersWithFeeds(
} else {
null
}
},
valueTransform = {
Feed(
@ -52,7 +51,7 @@ class GetFoldersWithFeeds(
}
}
foldersWithFeeds
foldersWithFeeds.toSortedMap(nullsLast(Folder::compareTo))
}
}
}

View File

@ -9,11 +9,19 @@ import kotlinx.coroutines.flow.Flow
@Dao
interface NewFolderDao : NewBaseDao<Folder> {
@Query("Select Feed.id As feedId, Feed.name As feedName, Feed.icon_url As feedIcon, Feed.url As feedUrl, " +
"Feed.siteUrl As feedSiteUrl, Feed.description as feedDescription, Feed.account_id As accountId, " +
"Folder.id As folderId, Folder.name As folderName, 0 as unreadCount " +
" From Feed Left Join Folder On Folder.id = Feed.folder_id " +
"Where Feed.folder_id is NULL OR Feed.folder_id is NOT NULL And Feed.account_id = :accountId Group By Feed.id")
@Query("""
Select Feed.id As feedId, Feed.name As feedName, Feed.icon_url As feedIcon, Feed.url As feedUrl,
Feed.siteUrl As feedSiteUrl, Feed.description as feedDescription,
Folder.id As folderId, Folder.name As folderName, Feed.account_id as accountId
From Feed Left Join Folder On Folder.id = Feed.folder_id
Where Feed.folder_id is NULL OR Feed.folder_id is NOT NULL And Feed.id is NULL Or Feed.id is NOT NULL And Feed.account_id = :accountId Group By Feed.id
UNION ALL
Select Feed.id As feedId, Feed.name As feedName, Feed.icon_url As feedIcon, Feed.url As feedUrl,
Feed.siteUrl As feedSiteUrl, Feed.description as feedDescription,
Folder.id As folderId, Folder.name As folderName, Folder.account_id as accountId
From Folder Left Join Feed On Folder.id = Feed.folder_id
Where Feed.id is NULL And Folder.account_id = :accountId
""")
fun selectFoldersAndFeeds(accountId: Int): Flow<List<FolderWithFeed>>
@Query("Select * From Folder Where account_id = :accountId")