diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-23 17:36:15 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:53 +0100 |
commit | 39445ead45aaaea801ec09991b8dd2464f722e47 (patch) | |
tree | 9306c6b89115dabdd4a7c31a59784134a0e1c804 /server/models/account/account.ts | |
parent | 16b90975941b78d01d7202d441bf731a10048c16 (diff) | |
download | PeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.tar.gz PeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.tar.zst PeerTube-39445ead45aaaea801ec09991b8dd2464f722e47.zip |
Cleanup models
Diffstat (limited to 'server/models/account/account.ts')
-rw-r--r-- | server/models/account/account.ts | 28 |
1 files changed, 1 insertions, 27 deletions
diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 9a2921501..f2bd325f3 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts | |||
@@ -20,14 +20,12 @@ import { addMethodsToModel } from '../utils' | |||
20 | import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' | 20 | import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' |
21 | 21 | ||
22 | let Account: Sequelize.Model<AccountInstance, AccountAttributes> | 22 | let Account: Sequelize.Model<AccountInstance, AccountAttributes> |
23 | let loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID | ||
24 | let load: AccountMethods.Load | 23 | let load: AccountMethods.Load |
25 | let loadApplication: AccountMethods.LoadApplication | 24 | let loadApplication: AccountMethods.LoadApplication |
26 | let loadByUUID: AccountMethods.LoadByUUID | 25 | let loadByUUID: AccountMethods.LoadByUUID |
27 | let loadByUrl: AccountMethods.LoadByUrl | 26 | let loadByUrl: AccountMethods.LoadByUrl |
28 | let loadLocalByName: AccountMethods.LoadLocalByName | 27 | let loadLocalByName: AccountMethods.LoadLocalByName |
29 | let loadByNameAndHost: AccountMethods.LoadByNameAndHost | 28 | let loadByNameAndHost: AccountMethods.LoadByNameAndHost |
30 | let listOwned: AccountMethods.ListOwned | ||
31 | let isOwned: AccountMethods.IsOwned | 29 | let isOwned: AccountMethods.IsOwned |
32 | let toActivityPubObject: AccountMethods.ToActivityPubObject | 30 | let toActivityPubObject: AccountMethods.ToActivityPubObject |
33 | let toFormattedJSON: AccountMethods.ToFormattedJSON | 31 | let toFormattedJSON: AccountMethods.ToFormattedJSON |
@@ -185,14 +183,12 @@ export default function defineAccount (sequelize: Sequelize.Sequelize, DataTypes | |||
185 | 183 | ||
186 | const classMethods = [ | 184 | const classMethods = [ |
187 | associate, | 185 | associate, |
188 | loadAccountByServerAndUUID, | ||
189 | loadApplication, | 186 | loadApplication, |
190 | load, | 187 | load, |
191 | loadByUUID, | 188 | loadByUUID, |
192 | loadByUrl, | 189 | loadByUrl, |
193 | loadLocalByName, | 190 | loadLocalByName, |
194 | loadByNameAndHost, | 191 | loadByNameAndHost |
195 | listOwned | ||
196 | ] | 192 | ] |
197 | const instanceMethods = [ | 193 | const instanceMethods = [ |
198 | isOwned, | 194 | isOwned, |
@@ -355,16 +351,6 @@ getPublicKeyUrl = function (this: AccountInstance) { | |||
355 | 351 | ||
356 | // ------------------------------ STATICS ------------------------------ | 352 | // ------------------------------ STATICS ------------------------------ |
357 | 353 | ||
358 | listOwned = function () { | ||
359 | const query: Sequelize.FindOptions<AccountAttributes> = { | ||
360 | where: { | ||
361 | serverId: null | ||
362 | } | ||
363 | } | ||
364 | |||
365 | return Account.findAll(query) | ||
366 | } | ||
367 | |||
368 | loadApplication = function () { | 354 | loadApplication = function () { |
369 | return Account.findOne({ | 355 | return Account.findOne({ |
370 | include: [ | 356 | include: [ |
@@ -441,15 +427,3 @@ loadByUrl = function (url: string, transaction?: Sequelize.Transaction) { | |||
441 | 427 | ||
442 | return Account.findOne(query) | 428 | return Account.findOne(query) |
443 | } | 429 | } |
444 | |||
445 | loadAccountByServerAndUUID = function (uuid: string, serverId: number, transaction: Sequelize.Transaction) { | ||
446 | const query: Sequelize.FindOptions<AccountAttributes> = { | ||
447 | where: { | ||
448 | serverId, | ||
449 | uuid | ||
450 | }, | ||
451 | transaction | ||
452 | } | ||
453 | |||
454 | return Account.find(query) | ||
455 | } | ||