mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Move project locator to mongojs
This commit is contained in:
parent
586d4cbae1
commit
6ca69f88ac
2 changed files with 6 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
Project = require('../../models/Project').Project
|
||||
ProjectGetter = require("./ProjectGetter")
|
||||
Errors = require "../../errors"
|
||||
_ = require('underscore')
|
||||
logger = require('logger-sharelatex')
|
||||
|
@ -50,7 +51,7 @@ module.exports =
|
|||
if project?
|
||||
startSearch(project)
|
||||
else
|
||||
Project.findById project_id, (err, project)->
|
||||
ProjectGetter.getProject project_id, (err, project)->
|
||||
return callback(err) if err?
|
||||
if !project?
|
||||
return callback(new Errors.NotFoundError("project not found"))
|
||||
|
|
|
@ -30,7 +30,7 @@ project.rootFolder[0] = rootFolder
|
|||
project.rootDoc_id = rootDoc._id
|
||||
|
||||
|
||||
describe 'project model', ->
|
||||
describe 'ProjectLocatorTests', ->
|
||||
|
||||
beforeEach ->
|
||||
Project.getProject = (project_id, fields, callback)=>
|
||||
|
@ -38,9 +38,12 @@ describe 'project model', ->
|
|||
|
||||
Project.findById = (project_id, callback)=>
|
||||
callback(null, project)
|
||||
@ProjectGetter =
|
||||
getProject: sinon.stub().callsArgWith(1, null, project)
|
||||
@locator = SandboxedModule.require modulePath, requires:
|
||||
'../../models/Project':{Project:Project}
|
||||
'../../models/User':{User:@User}
|
||||
"./ProjectGetter":@ProjectGetter
|
||||
'logger-sharelatex':
|
||||
log:->
|
||||
err:->
|
||||
|
|
Loading…
Reference in a new issue