Merge pull request #9962 from overleaf/em-remove-project-history-importer

Remove the separate config for project history importer

GitOrigin-RevId: 7f3eee81ea570241e7aba2a86684c8495a567e7f
This commit is contained in:
Eric Mc Sween 2022-10-13 11:40:15 -04:00 committed by Copybot
parent a4c76ba1ec
commit 567efe007f

View file

@ -4,25 +4,6 @@ const settings = require('@overleaf/settings')
const OError = require('@overleaf/o-error')
const UserGetter = require('../User/UserGetter')
module.exports = {
initializeProject: callbackify(initializeProject),
flushProject: callbackify(flushProject),
flushMigration: callbackify(flushMigration),
resyncProject: callbackify(resyncProject),
deleteProject: callbackify(deleteProject),
deleteProjectHistory: callbackify(deleteProjectHistory),
injectUserDetails: callbackify(injectUserDetails),
promises: {
initializeProject,
flushProject,
flushMigration,
resyncProject,
deleteProject,
injectUserDetails,
deleteProjectHistory,
},
}
async function initializeProject() {
if (
!(
@ -64,19 +45,6 @@ async function flushProject(projectId) {
}
}
async function flushMigration(projectId) {
const response = await fetch(
`${settings.apis.project_history_importer.url}/project/${projectId}/flush`,
{ method: 'POST' }
)
if (!response.ok) {
throw new OError(
'failed to flush project migration to project history importer',
{ projectId, statusCode: response.status }
)
}
}
async function deleteProjectHistory(projectId) {
const response = await fetch(
`${settings.apis.project_history.url}/project/${projectId}`,
@ -238,3 +206,20 @@ function _userView(user) {
const { _id, first_name: firstName, last_name: lastName, email } = user
return { first_name: firstName, last_name: lastName, email, id: _id }
}
module.exports = {
initializeProject: callbackify(initializeProject),
flushProject: callbackify(flushProject),
resyncProject: callbackify(resyncProject),
deleteProject: callbackify(deleteProject),
deleteProjectHistory: callbackify(deleteProjectHistory),
injectUserDetails: callbackify(injectUserDetails),
promises: {
initializeProject,
flushProject,
resyncProject,
deleteProject,
injectUserDetails,
deleteProjectHistory,
},
}