Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.mdns.eu/nextcloud/passwords-client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model/Folder')
-rw-r--r--src/Model/Folder/EnhancedFolder.js36
-rw-r--r--src/Model/Folder/Folder.js76
2 files changed, 109 insertions, 3 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
diff --git a/src/Model/Folder/Folder.js b/src/Model/Folder/Folder.js
index cac6f17..46c4b76 100644
--- a/src/Model/Folder/Folder.js
+++ b/src/Model/Folder/Folder.js
@@ -30,16 +30,90 @@ export default class Folder extends AbstractRevisionModel {
/**
* @return {String}
*/
+ getParentId() {
+ if(this._properties.hasOwnProperty('parent')) {
+ return this.getParent().getId();
+ }
+
+ return this.getProperty('parentId');
+ }
+
+ /**
+ * @param {String} value
+ *
+ * @return {Folder}
+ */
+ setParentId(value) {
+ if(this._properties.hasOwnProperty('parent')) {
+ return this.setParent(null);
+ }
+
+ this.setProperty('parentId', value);
+
+ return this;
+ }
+
+ /**
+ * @return {Folder}
+ */
getParent() {
return this.getProperty('parent');
}
/**
- * @param {String} value
+ * @param {Folder} value
*
* @return {Folder}
*/
setParent(value) {
return this.setProperty('parent', value);
}
+
+ /**
+ * @return {(FolderCollection|null)}
+ */
+ getFolders() {
+ return this.getProperty('folders');
+ }
+
+ /**
+ * @param {(FolderCollection|null)} value
+ *
+ * @return {Folder}
+ */
+ setFolders(value) {
+ return this.setProperty('folders', value);
+ }
+
+ /**
+ * @return {(PasswordCollection|null)}
+ */
+ getPasswords() {
+ return this.getProperty('passwords');
+ }
+
+ /**
+ * @param {(PasswordCollection|null)} value
+ *
+ * @return {Folder}
+ */
+ setPasswords(value) {
+ return this.setProperty('passwords', value);
+ }
+
+ /**
+ * @return {(FolderCollection|null)}
+ */
+ getRevisions() {
+ return this.getProperty('revisions');
+ }
+
+ /**
+ * @param {(FolderCollection|null)} value
+ *
+ * @return {Folder}
+ */
+ setRevisions(value) {
+ return this.setProperty('revisions', value);
+ }
} \ No newline at end of file