aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-23 17:36:15 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:53 +0100
commit39445ead45aaaea801ec09991b8dd2464f722e47 (patch)
tree9306c6b89115dabdd4a7c31a59784134a0e1c804 /server/models/account/account.ts
parent16b90975941b78d01d7202d441bf731a10048c16 (diff)
downloadPeerTube-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.ts28
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'
20import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' 20import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface'
21 21
22let Account: Sequelize.Model<AccountInstance, AccountAttributes> 22let Account: Sequelize.Model<AccountInstance, AccountAttributes>
23let loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID
24let load: AccountMethods.Load 23let load: AccountMethods.Load
25let loadApplication: AccountMethods.LoadApplication 24let loadApplication: AccountMethods.LoadApplication
26let loadByUUID: AccountMethods.LoadByUUID 25let loadByUUID: AccountMethods.LoadByUUID
27let loadByUrl: AccountMethods.LoadByUrl 26let loadByUrl: AccountMethods.LoadByUrl
28let loadLocalByName: AccountMethods.LoadLocalByName 27let loadLocalByName: AccountMethods.LoadLocalByName
29let loadByNameAndHost: AccountMethods.LoadByNameAndHost 28let loadByNameAndHost: AccountMethods.LoadByNameAndHost
30let listOwned: AccountMethods.ListOwned
31let isOwned: AccountMethods.IsOwned 29let isOwned: AccountMethods.IsOwned
32let toActivityPubObject: AccountMethods.ToActivityPubObject 30let toActivityPubObject: AccountMethods.ToActivityPubObject
33let toFormattedJSON: AccountMethods.ToFormattedJSON 31let 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
358listOwned = function () {
359 const query: Sequelize.FindOptions<AccountAttributes> = {
360 where: {
361 serverId: null
362 }
363 }
364
365 return Account.findAll(query)
366}
367
368loadApplication = function () { 354loadApplication = 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
445loadAccountByServerAndUUID = 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}