First typescript iteration

This commit is contained in:
Chocobozzz 2017-05-15 22:22:03 +02:00
parent d5f345ed4c
commit 65fcc3119c
113 changed files with 1961 additions and 1784 deletions

21
server/models/utils.ts Normal file
View file

@ -0,0 +1,21 @@
// Translate for example "-name" to [ 'name', 'DESC' ]
function getSort (value) {
let field
let direction
if (value.substring(0, 1) === '-') {
direction = 'DESC'
field = value.substring(1)
} else {
direction = 'ASC'
field = value
}
return [ field, direction ]
}
// ---------------------------------------------------------------------------
export {
getSort
}