-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PB-3097, PB-2977] Filter files in trash - Delete files from deleted folders #422
base: master
Are you sure you want to change the base?
Conversation
src/modules/folder/folder.usecase.ts
Outdated
const files = await this.fileUsecases.getFilesByFolderUuid( | ||
folder.uuid, | ||
FileStatus.TRASHED, | ||
); | ||
const fileIds = files.map((f) => f.fileId); | ||
const updateFileData: Partial<File> = { | ||
deleted: false, | ||
deletedAt: null, | ||
status: FileStatus.EXISTS, | ||
}; | ||
|
||
await this.fileUsecases.updateManyByFileIdAndUserId( | ||
fileIds, | ||
user.id, | ||
updateFileData, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to make a query that updates all the files inside that folder instead of fetching and updating them. We have no limits for files inside a folder, so if an user has 10k files in a folder, those are 10k files you're fetching/looping through here.
src/modules/file/file.usecase.ts
Outdated
@@ -36,6 +36,7 @@ import { WorkspaceAttributes } from '../workspaces/attributes/workspace.attribut | |||
import { Folder } from '../folder/folder.domain'; | |||
import { getPathFileData } from '../../lib/path'; | |||
import { isStringEmpty } from '../../lib/validators'; | |||
import { Op } from 'sequelize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try to use this in the repository? You can find the reason in this comment: #428 (comment)
Quality Gate passedIssues Measures |
This PR it's non-sense. The issue with this thing is related to the background deletion system we have on Drive. It is deleted eventually. If you want to filter Recents and Trash without still-not-deleted items, you need to do a recursive query when listing those items, to check if any of their folder parents |
Ticket
Updates
Recents
sectionTrash
section