mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
21 lines
544 B
CoffeeScript
21 lines
544 B
CoffeeScript
mongojs = require("../../infrastructure/mongojs")
|
|
metrics = require("../../infrastructure/Metrics")
|
|
db = mongojs.db
|
|
ObjectId = mongojs.ObjectId
|
|
logger = require('logger-sharelatex')
|
|
|
|
module.exports = UserLocator =
|
|
|
|
findByEmail: (email, callback)->
|
|
email = email.trim()
|
|
db.users.findOne email:email, (err, user)->
|
|
callback(err, user)
|
|
|
|
findById: (_id, callback)->
|
|
db.users.findOne _id:ObjectId(_id+""), callback
|
|
|
|
[
|
|
'findById',
|
|
'findByEmail'
|
|
].map (method) ->
|
|
metrics.timeAsyncMethod UserLocator, method, 'mongo.UserLocator', logger
|