diff options
Diffstat (limited to 'server/models/utils.ts')
-rw-r--r-- | server/models/utils.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/models/utils.ts b/server/models/utils.ts index 601811913..fd84a9239 100644 --- a/server/models/utils.ts +++ b/server/models/utils.ts | |||
@@ -14,8 +14,14 @@ function getSort (value) { | |||
14 | return [ field, direction ] | 14 | return [ field, direction ] |
15 | } | 15 | } |
16 | 16 | ||
17 | function addMethodsToModel (model: any, classMethods: Function[], instanceMethods: Function[] = []) { | ||
18 | classMethods.forEach(m => model[m.name] = m) | ||
19 | instanceMethods.forEach(m => model.prototype[m.name] = m) | ||
20 | } | ||
21 | |||
17 | // --------------------------------------------------------------------------- | 22 | // --------------------------------------------------------------------------- |
18 | 23 | ||
19 | export { | 24 | export { |
25 | addMethodsToModel, | ||
20 | getSort | 26 | getSort |
21 | } | 27 | } |