From 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 14 Nov 2017 17:31:26 +0100 Subject: Follow works --- server/models/application/application.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'server/models/application/application.ts') diff --git a/server/models/application/application.ts b/server/models/application/application.ts index 507b7a843..8ba40a895 100644 --- a/server/models/application/application.ts +++ b/server/models/application/application.ts @@ -11,6 +11,7 @@ import { let Application: Sequelize.Model let loadMigrationVersion: ApplicationMethods.LoadMigrationVersion let updateMigrationVersion: ApplicationMethods.UpdateMigrationVersion +let countTotal: ApplicationMethods.CountTotal export default function defineApplication (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { Application = sequelize.define('Application', @@ -26,7 +27,11 @@ export default function defineApplication (sequelize: Sequelize.Sequelize, DataT } ) - const classMethods = [ loadMigrationVersion, updateMigrationVersion ] + const classMethods = [ + countTotal, + loadMigrationVersion, + updateMigrationVersion + ] addMethodsToModel(Application, classMethods) return Application @@ -34,6 +39,10 @@ export default function defineApplication (sequelize: Sequelize.Sequelize, DataT // --------------------------------------------------------------------------- +countTotal = function () { + return this.count() +} + loadMigrationVersion = function () { const query = { attributes: [ 'migrationVersion' ] -- cgit v1.2.3