Sort the project entities by path

This commit is contained in:
Shane Kilkelly 2018-05-04 11:06:59 +01:00
parent 08263180fa
commit 30beb098ab

View file

@ -163,6 +163,7 @@ module.exports = ProjectController =
ProjectEntityHandler.getAllEntitiesFromProject project, (err, docs, files) -> ProjectEntityHandler.getAllEntitiesFromProject project, (err, docs, files) ->
return next(err) if err? return next(err) if err?
entities = docs.concat(files) entities = docs.concat(files)
.sort (a, b) -> a.path > b.path # Sort by path ascending
.map (e) -> { .map (e) -> {
path: e.path, path: e.path,
type: if e.doc? then 'doc' else 'file' type: if e.doc? then 'doc' else 'file'