[history-v1] fix backup deletion for postgres projects (#23466)

* [history-v1] fix backup deletion for postgres projects

* [history-v1] convert historyId to string on assignment

Co-authored-by: Brian Gough <brian.gough@overleaf.com>

---------

Co-authored-by: Brian Gough <brian.gough@overleaf.com>
GitOrigin-RevId: 5e1033972745a9b72606638f56ebf2147406cc39
This commit is contained in:
Jakob Ackermann
2025-02-10 09:05:06 +00:00
committed by Copybot
co-authored by Brian Gough
parent 3082e4c5cc
commit 64e8d2b8b3
2 changed files with 5 additions and 4 deletions
@@ -51,7 +51,8 @@ async function deleteProjectBackup(projectId) {
throw new NotReadyToDelete('refusing to delete non-expired project')
}
const historyId = deletedProject.deleterData.deletedProjectOverleafHistoryId
const historyId =
deletedProject.deleterData.deletedProjectOverleafHistoryId?.toString()
if (!historyId) {
throw new NotReadyToDelete(
'refusing to delete project with unknown historyId'
@@ -50,7 +50,7 @@ async function deleteProject(projectId) {
}
/**
* @param {string|ObjectId} historyId
* @param {number|ObjectId} historyId
* @return {Promise<void>}
*/
async function expectToHaveBackup(historyId) {
@@ -61,7 +61,7 @@ async function expectToHaveBackup(historyId) {
}
/**
* @param {string|ObjectId} historyId
* @param {number|ObjectId} historyId
* @return {Promise<void>}
*/
async function expectToHaveNoBackup(historyId) {
@@ -90,7 +90,7 @@ describe('backupDeletion', function () {
})
describe('DELETE /project/:projectId', function () {
const postgresHistoryId = '1'
const postgresHistoryId = 1
const projectIdPostgres = new ObjectId('000000000000000000000001')
const projectIdMongoDB = new ObjectId('000000000000000000000002')
const projectIdNonDeleted = new ObjectId('000000000000000000000003')