diff options
author | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-02 02:09:25 +0300 |
---|---|---|
committer | Marius David Wieschollek <passwords.public@mdns.eu> | 2020-12-02 02:09:25 +0300 |
commit | 277f5a1571a1a839d4f000a8ef65e35cba5b05ce (patch) | |
tree | fca78bd10526c8b1dc62d51252dd4ca0e26ac6e0 /src/Model/Folder/EnhancedFolder.js | |
parent | 16ac1f3d221b49b09001bda1d5f1194c5a7cafdd (diff) |
Add model service and support for detail levels
Signed-off-by: Marius David Wieschollek <passwords.public@mdns.eu>
Diffstat (limited to 'src/Model/Folder/EnhancedFolder.js')
-rw-r--r-- | src/Model/Folder/EnhancedFolder.js | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/src/Model/Folder/EnhancedFolder.js b/src/Model/Folder/EnhancedFolder.js index 4198d61..fbec6ce 100644 --- a/src/Model/Folder/EnhancedFolder.js +++ b/src/Model/Folder/EnhancedFolder.js @@ -22,17 +22,49 @@ export default class EnhancedFolder extends Folder { /** * - * @returns {Promise<Folder[]>} + * @returns {Promise<FolderCollection[]>} */ async fetchRevisions() { + if(this.getProperty('revisions') === undefined) { + await this._api.getFolderRepository().findById(this.getId(), 'revisions'); + } + return this.getProperty('revisions'); } /** * - * @returns {Promise<Password[]>} + * @returns {Promise<PasswordCollection[]>} */ async fetchPasswords() { + if(this.getProperty('passwords') === undefined) { + await this._api.getFolderRepository().findById(this.getId(), 'passwords'); + } + + return this.getProperty('passwords'); + } + + /** + * + * @returns {Promise<FolderCollection[]>} + */ + async fetchFolders() { + if(this.getProperty('folders') === undefined) { + await this._api.getFolderRepository().findById(this.getId(), 'folders'); + } + + return this.getProperty('folders'); + } + + /** + * + * @returns {Promise<Folder[]>} + */ + async fetchParent() { + if(this.getProperty('parent') === undefined) { + await this._api.getFolderRepository().findById(this.getId(), 'parent'); + } + return this.getProperty('parent'); } }
\ No newline at end of file |