First typescript iteration
This commit is contained in:
parent
d5f345ed4c
commit
65fcc3119c
113 changed files with 1961 additions and 1784 deletions
21
server/models/utils.ts
Normal file
21
server/models/utils.ts
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue