From e02643f32e4c97ca307f8fc5b69be79c40d70a3b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 22 May 2017 20:58:25 +0200 Subject: Type models --- server/models/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'server/models/utils.ts') 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) { return [ field, direction ] } +function addMethodsToModel (model: any, classMethods: Function[], instanceMethods: Function[] = []) { + classMethods.forEach(m => model[m.name] = m) + instanceMethods.forEach(m => model.prototype[m.name] = m) +} + // --------------------------------------------------------------------------- export { + addMethodsToModel, getSort } -- cgit v1.2.3