Merge pull request #1861 from overleaf/bg-check-existing-import

check if project already imported

GitOrigin-RevId: 6dbca42fd524c34bb79a86b7449fe6ed3d542b43
This commit is contained in:
Brian Gough 2019-06-13 09:37:20 +01:00 committed by sharelatex
parent c242a8d4c1
commit 4134c32f8d

View file

@ -148,6 +148,24 @@ module.exports = ProjectGetter = {
)
},
getProjectByV1Id(v1_id, callback) {
if (callback == null) {
callback = function(err, v1_id) {}
}
return Project.findOne({ 'overleaf.id': v1_id }, { _id: 1 }, function(
err,
project
) {
if (err != null) {
return callback(err)
}
if (project == null) {
return callback()
}
return callback(null, project._id)
})
},
findAllUsersProjects(user_id, fields, callback) {
if (callback == null) {
callback = function(error, projects) {