overleaf/services/web/app/coffee/infrastructure/LoggerSerializers.coffee

41 lines
586 B
CoffeeScript
Raw Normal View History

2014-02-12 10:23:40 +00:00
module.exports =
user: (user) ->
2016-10-25 14:50:05 +00:00
if !user?
return null
2014-02-12 10:23:40 +00:00
if !user._id?
user = {_id : user}
return {
id: user._id
email: user.email
first_name: user.name
last_name: user.name
}
2014-02-12 10:23:40 +00:00
project: (project) ->
2016-10-25 14:50:05 +00:00
if !project?
return null
2014-02-12 10:23:40 +00:00
if !project._id?
project = {_id: project}
return {
id: project._id
name: project.name
}
docs: (docs) ->
if !docs?.map?
return
2018-03-27 13:45:47 +00:00
docs.map (doc) ->
{
path: doc.path
id: doc.doc
}
files: (files) ->
if !files?.map?
return
2018-03-27 13:45:47 +00:00
files.map (file) ->
{
path: file.path
id: file.file
}