diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-14 17:31:26 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad (patch) | |
tree | f4191f3c04a5230fcf8ca3d6ca3248643fc4151d /server/models/application/application.ts | |
parent | e34c85e527100c0b5c44567bd951e95be41b8d7e (diff) | |
download | PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.gz PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.tar.zst PeerTube-350e31d6b64e4973dfa5e9f7b46841cb09aeb1ad.zip |
Follow works
Diffstat (limited to 'server/models/application/application.ts')
-rw-r--r-- | server/models/application/application.ts | 11 |
1 files changed, 10 insertions, 1 deletions
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 { | |||
11 | let Application: Sequelize.Model<ApplicationInstance, ApplicationAttributes> | 11 | let Application: Sequelize.Model<ApplicationInstance, ApplicationAttributes> |
12 | let loadMigrationVersion: ApplicationMethods.LoadMigrationVersion | 12 | let loadMigrationVersion: ApplicationMethods.LoadMigrationVersion |
13 | let updateMigrationVersion: ApplicationMethods.UpdateMigrationVersion | 13 | let updateMigrationVersion: ApplicationMethods.UpdateMigrationVersion |
14 | let countTotal: ApplicationMethods.CountTotal | ||
14 | 15 | ||
15 | export default function defineApplication (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { | 16 | export default function defineApplication (sequelize: Sequelize.Sequelize, DataTypes: Sequelize.DataTypes) { |
16 | Application = sequelize.define<ApplicationInstance, ApplicationAttributes>('Application', | 17 | Application = sequelize.define<ApplicationInstance, ApplicationAttributes>('Application', |
@@ -26,7 +27,11 @@ export default function defineApplication (sequelize: Sequelize.Sequelize, DataT | |||
26 | } | 27 | } |
27 | ) | 28 | ) |
28 | 29 | ||
29 | const classMethods = [ loadMigrationVersion, updateMigrationVersion ] | 30 | const classMethods = [ |
31 | countTotal, | ||
32 | loadMigrationVersion, | ||
33 | updateMigrationVersion | ||
34 | ] | ||
30 | addMethodsToModel(Application, classMethods) | 35 | addMethodsToModel(Application, classMethods) |
31 | 36 | ||
32 | return Application | 37 | return Application |
@@ -34,6 +39,10 @@ export default function defineApplication (sequelize: Sequelize.Sequelize, DataT | |||
34 | 39 | ||
35 | // --------------------------------------------------------------------------- | 40 | // --------------------------------------------------------------------------- |
36 | 41 | ||
42 | countTotal = function () { | ||
43 | return this.count() | ||
44 | } | ||
45 | |||
37 | loadMigrationVersion = function () { | 46 | loadMigrationVersion = function () { |
38 | const query = { | 47 | const query = { |
39 | attributes: [ 'migrationVersion' ] | 48 | attributes: [ 'migrationVersion' ] |