Merge pull request #22202 from overleaf/jpa-tpds

[misc] tpds: read files from history-v1 with fallback to filestore

GitOrigin-RevId: afdde47e453b0cb07985392b5e2b03abf348debf
This commit is contained in:
Jakob Ackermann
2024-11-28 12:48:52 +01:00
committed by Copybot
parent cc60acd4ea
commit 892eaabdf7
6 changed files with 99 additions and 18 deletions
@@ -596,7 +596,9 @@ const upsertFile = wrapWithLock({
const projectHistoryId = project.overleaf?.history?.id
await TpdsUpdateSender.promises.addFile({
projectId: project._id,
historyId: projectHistoryId,
fileId: fileRef._id,
hash: fileRef.hash,
path: path.fileSystem,
rev: fileRef.rev,
projectName: project.name,
@@ -1298,9 +1300,15 @@ const ProjectEntityUpdateHandler = {
})
}
const historyId = project?.overleaf?.history?.id
if (!historyId) {
throw new OError('project does not have a history id', { projectId })
}
await TpdsUpdateSender.promises.addFile({
projectId,
historyId,
fileId: fileRef._id,
hash: fileRef.hash,
path: result?.path?.fileSystem,
projectName: project.name,
rev: fileRef.rev,
@@ -1346,7 +1354,9 @@ const ProjectEntityUpdateHandler = {
const projectHistoryId = project.overleaf?.history?.id
await TpdsUpdateSender.promises.addFile({
projectId: project._id,
historyId: projectHistoryId,
fileId: updatedFileRef._id,
hash: updatedFileRef.hash,
path: path.fileSystem,
rev: updatedFileRef.rev,
projectName: project.name,