diff options
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/account-interface.ts | 4 | ||||
-rw-r--r-- | server/models/account/account.ts | 28 |
2 files changed, 1 insertions, 31 deletions
diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts index e30260f76..2e4b0382d 100644 --- a/server/models/account/account-interface.ts +++ b/server/models/account/account-interface.ts | |||
@@ -10,10 +10,8 @@ export namespace AccountMethods { | |||
10 | export type Load = (id: number) => Bluebird<AccountInstance> | 10 | export type Load = (id: number) => Bluebird<AccountInstance> |
11 | export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance> | 11 | export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance> |
12 | export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance> | 12 | export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance> |
13 | export type LoadAccountByServerAndUUID = (uuid: string, serverId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance> | ||
14 | export type LoadLocalByName = (name: string) => Bluebird<AccountInstance> | 13 | export type LoadLocalByName = (name: string) => Bluebird<AccountInstance> |
15 | export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance> | 14 | export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance> |
16 | export type ListOwned = () => Bluebird<AccountInstance[]> | ||
17 | 15 | ||
18 | export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor | 16 | export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor |
19 | export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount | 17 | export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount |
@@ -26,13 +24,11 @@ export namespace AccountMethods { | |||
26 | 24 | ||
27 | export interface AccountClass { | 25 | export interface AccountClass { |
28 | loadApplication: AccountMethods.LoadApplication | 26 | loadApplication: AccountMethods.LoadApplication |
29 | loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID | ||
30 | load: AccountMethods.Load | 27 | load: AccountMethods.Load |
31 | loadByUUID: AccountMethods.LoadByUUID | 28 | loadByUUID: AccountMethods.LoadByUUID |
32 | loadByUrl: AccountMethods.LoadByUrl | 29 | loadByUrl: AccountMethods.LoadByUrl |
33 | loadLocalByName: AccountMethods.LoadLocalByName | 30 | loadLocalByName: AccountMethods.LoadLocalByName |
34 | loadByNameAndHost: AccountMethods.LoadByNameAndHost | 31 | loadByNameAndHost: AccountMethods.LoadByNameAndHost |
35 | listOwned: AccountMethods.ListOwned | ||
36 | } | 32 | } |
37 | 33 | ||
38 | export interface AccountAttributes { | 34 | export interface AccountAttributes { |
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 | } | ||