[web] remove deledFiles collection (#25750)

* [history-v1] remove processing of deleted files when back-filling hashes

* [web] remove deledFiles collection

GitOrigin-RevId: 7c080e564f7d7acb33ebe7ebe012f415a847d0df
This commit is contained in:
Jakob Ackermann
2025-05-22 10:15:52 +01:00
committed by Copybot
parent 8926a64ba6
commit dfed87723f
21 changed files with 155 additions and 809 deletions

View File

@@ -4,7 +4,6 @@ const tk = require('timekeeper')
const Errors = require('../../../../app/src/Features/Errors/Errors')
const { ObjectId } = require('mongodb-legacy')
const SandboxedModule = require('sandboxed-module')
const { DeletedFile } = require('../helpers/models/DeletedFile')
const { Project } = require('../helpers/models/Project')
const MODULE_PATH =
@@ -77,7 +76,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
}
this.FolderModel = sinon.stub()
this.DeletedFileMock = sinon.mock(DeletedFile)
this.ProjectMock = sinon.mock(Project)
this.ProjectEntityHandler = {
getAllEntitiesFromProject: sinon.stub(),
@@ -197,7 +195,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
'../Cooldown/CooldownManager': this.CooldownManager,
'../../models/Folder': { Folder: this.FolderModel },
'../../infrastructure/LockManager': this.LockManager,
'../../models/DeletedFile': { DeletedFile },
'../../models/Project': { Project },
'./ProjectEntityHandler': this.ProjectEntityHandler,
'./ProjectLocator': this.ProjectLocator,
@@ -208,7 +205,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
})
afterEach(function () {
this.DeletedFileMock.restore()
this.ProjectMock.restore()
tk.reset()
})
@@ -374,17 +370,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
linkedFileData: { some: 'data' },
hash: 'some-hash',
}
// Add a deleted file record
this.DeletedFileMock.expects('create')
.withArgs({
projectId: this.project._id,
_id: this.file._id,
name: this.file.name,
linkedFileData: this.file.linkedFileData,
hash: this.file.hash,
deletedAt: sinon.match.date,
})
.resolves()
// Update the file in place
this.ProjectMock.expects('findOneAndUpdate')
.withArgs(
@@ -421,7 +406,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
})
it('updates the database', function () {
this.DeletedFileMock.verify()
this.ProjectMock.verify()
})
})
@@ -1059,29 +1043,6 @@ describe('ProjectEntityMongoUpdateHandler', function () {
})
})
describe('_insertDeletedFileReference', function () {
beforeEach(async function () {
this.DeletedFileMock.expects('create')
.withArgs({
projectId: this.project._id,
_id: this.file._id,
name: this.file.name,
linkedFileData: this.file.linkedFileData,
hash: this.file.hash,
deletedAt: sinon.match.date,
})
.resolves()
await this.subject.promises._insertDeletedFileReference(
this.project._id,
this.file
)
})
it('should update the database', function () {
this.DeletedFileMock.verify()
})
})
describe('createNewFolderStructure', function () {
beforeEach(function () {
this.mockRootFolder = 'MOCK_ROOT_FOLDER'