overleaf/services/web/app/coffee/infrastructure/LoggerSerializers.coffee
2018-03-09 11:16:35 +00:00

36 lines
531 B
CoffeeScript

module.exports =
user: (user) ->
if !user?
return null
if !user._id?
user = {_id : user}
return {
id: user._id
email: user.email
first_name: user.name
last_name: user.name
}
project: (project) ->
if !project?
return null
if !project._id?
project = {_id: project}
return {
id: project._id
name: project.name
}
docs: (docs) ->
docs.map (doc) ->
{
path: doc.path
id: doc.doc
}
files: (files) ->
files.map (file) ->
{
path: file.path
id: file.file
}