only export user personal files

This commit is contained in:
Abhinav 2021-12-07 14:24:28 +05:30
parent 3dd90ba538
commit cf09858fb7

View file

@ -128,13 +128,15 @@ class ExportService {
return; return;
} }
let filesToExport: File[]; let filesToExport: File[];
const allFiles = (await getLocalFiles()).sort( const localFiles = await getLocalFiles();
(fileA, fileB) => fileA.id - fileB.id const userPersonalFiles = localFiles
); .filter((file) => file.ownerID === user?.id)
.sort((fileA, fileB) => fileA.id - fileB.id);
const collections = await getLocalCollections(); const collections = await getLocalCollections();
const nonEmptyCollections = getNonEmptyCollections( const nonEmptyCollections = getNonEmptyCollections(
collections, collections,
allFiles userPersonalFiles
); );
const user: User = getData(LS_KEYS.USER); const user: User = getData(LS_KEYS.USER);
const userCollections = nonEmptyCollections const userCollections = nonEmptyCollections
@ -144,17 +146,23 @@ class ExportService {
collectionA.id - collectionB.id collectionA.id - collectionB.id
); );
const exportRecord = await this.getExportRecord(exportDir); const exportRecord = await this.getExportRecord(exportDir);
await this.migrateExport(exportDir, collections, allFiles); await this.migrateExport(exportDir, collections, userPersonalFiles);
if (exportType === ExportType.NEW) { if (exportType === ExportType.NEW) {
filesToExport = getFilesUploadedAfterLastExport( filesToExport = getFilesUploadedAfterLastExport(
allFiles, userPersonalFiles,
exportRecord exportRecord
); );
} else if (exportType === ExportType.RETRY_FAILED) { } else if (exportType === ExportType.RETRY_FAILED) {
filesToExport = getExportFailedFiles(allFiles, exportRecord); filesToExport = getExportFailedFiles(
userPersonalFiles,
exportRecord
);
} else { } else {
filesToExport = getExportQueuedFiles(allFiles, exportRecord); filesToExport = getExportQueuedFiles(
userPersonalFiles,
exportRecord
);
} }
this.exportInProgress = this.fileExporter( this.exportInProgress = this.fileExporter(
filesToExport, filesToExport,