mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Add convenience method to get child directories from database manager
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
65ab13c0f9
commit
64e32b48eb
1 changed files with 7 additions and 0 deletions
|
@ -312,6 +312,13 @@ class NextcloudFilesDatabaseManager : NSObject {
|
|||
return nil
|
||||
}
|
||||
|
||||
func childDirectoriesForDirectory(_ directoryMetadata: NextcloudDirectoryMetadataTable) -> [NextcloudDirectoryMetadataTable] {
|
||||
let database = ncDatabase()
|
||||
let metadatas = database.objects(NextcloudDirectoryMetadataTable.self).filter("serverUrl BEGINSWITH %@ AND ocId != %@", directoryMetadata.serverUrl, directoryMetadata.account)
|
||||
let sortedMetadatas = metadatas.sorted(byKeyPath: "serverUrl", ascending: true)
|
||||
return Array(sortedMetadatas.map { NextcloudDirectoryMetadataTable(value: $0) })
|
||||
}
|
||||
|
||||
func parentDirectoryMetadataForItem(_ itemMetadata: NextcloudItemMetadataTable) -> NextcloudDirectoryMetadataTable? {
|
||||
return directoryMetadata(account: itemMetadata.account, serverUrl: itemMetadata.serverUrl)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue