This commit is contained in:
Peter Maquiran
2023-08-11 16:38:23 +01:00
parent 19ddb18148
commit 0671471f59
25 changed files with 400 additions and 195 deletions
+26 -15
View File
@@ -11,6 +11,8 @@ export class PublicationFolderService {
publicationList: {[key: string]: Publication[] } = {};
FolderDetails: {[key: string]: PublicationFolder } = {};
restoreFolder: {} = {}
keyName: string
constructor(
@@ -18,21 +20,29 @@ export class PublicationFolderService {
) {}
getFromDB(folderId: any) {
createPublicationList(folderId) {
if(!this.publicationList[folderId]) {
this.publicationList[folderId] = []
}
if(!this.FolderDetails[folderId]) {
this.FolderDetails[folderId] = new PublicationFolder();
}
}
this.storage.get(folderId).then((viewPublications) => {
this.publicationList[folderId] = viewPublications
})
this.storage.get(folderId+"name").then((viewPublications) => {
this.FolderDetails[folderId] = viewPublications
})
getFromDB(folderId: any) {
if(!this.restoreFolder[folderId]) {
this.storage.get(folderId).then((viewPublications) => {
this.publicationList[folderId] = viewPublications
})
this.storage.get(folderId+"name").then((viewPublications) => {
this.FolderDetails[folderId] = viewPublications
})
}
this.restoreFolder[folderId] = true
}
updateFolderDetails(folderId, res) {
@@ -68,15 +78,16 @@ export class PublicationFolderService {
}
}
deletePost(publicationId: any, folderId) {
for (let i = 0; i <= this.publicationList[folderId].length; i++) {
if(this.publicationList[folderId][i].DocumentId == publicationId) {
this.publicationList[folderId].splice(i, 1)
}
}
deletePost(folderId: any, publicationId: any) {
if(this.publicationList[folderId]) {
this.publicationList[folderId] = this.publicationList[folderId].filter( e => e.DocumentId != publicationId)
this.save(folderId)
}
}
}