mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 13:50:21 -05:00
40 lines
586 B
CoffeeScript
40 lines
586 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) ->
|
|
if !docs?.map?
|
|
return
|
|
docs.map (doc) ->
|
|
{
|
|
path: doc.path
|
|
id: doc.doc
|
|
}
|
|
|
|
files: (files) ->
|
|
if !files?.map?
|
|
return
|
|
files.map (file) ->
|
|
{
|
|
path: file.path
|
|
id: file.file
|
|
}
|