From 39445ead45aaaea801ec09991b8dd2464f722e47 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 23 Nov 2017 17:36:15 +0100 Subject: Cleanup models --- server/models/account/account-interface.ts | 4 ---- server/models/account/account.ts | 28 +--------------------------- 2 files changed, 1 insertion(+), 31 deletions(-) (limited to 'server/models/account') 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 { export type Load = (id: number) => Bluebird export type LoadByUUID = (uuid: string) => Bluebird export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird - export type LoadAccountByServerAndUUID = (uuid: string, serverId: number, transaction: Sequelize.Transaction) => Bluebird export type LoadLocalByName = (name: string) => Bluebird export type LoadByNameAndHost = (name: string, host: string) => Bluebird - export type ListOwned = () => Bluebird export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount @@ -26,13 +24,11 @@ export namespace AccountMethods { export interface AccountClass { loadApplication: AccountMethods.LoadApplication - loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID load: AccountMethods.Load loadByUUID: AccountMethods.LoadByUUID loadByUrl: AccountMethods.LoadByUrl loadLocalByName: AccountMethods.LoadLocalByName loadByNameAndHost: AccountMethods.LoadByNameAndHost - listOwned: AccountMethods.ListOwned } 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' import { AccountAttributes, AccountInstance, AccountMethods } from './account-interface' let Account: Sequelize.Model -let loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID let load: AccountMethods.Load let loadApplication: AccountMethods.LoadApplication let loadByUUID: AccountMethods.LoadByUUID let loadByUrl: AccountMethods.LoadByUrl let loadLocalByName: AccountMethods.LoadLocalByName let loadByNameAndHost: AccountMethods.LoadByNameAndHost -let listOwned: AccountMethods.ListOwned let isOwned: AccountMethods.IsOwned let toActivityPubObject: AccountMethods.ToActivityPubObject let toFormattedJSON: AccountMethods.ToFormattedJSON @@ -185,14 +183,12 @@ export default function defineAccount (sequelize: Sequelize.Sequelize, DataTypes const classMethods = [ associate, - loadAccountByServerAndUUID, loadApplication, load, loadByUUID, loadByUrl, loadLocalByName, - loadByNameAndHost, - listOwned + loadByNameAndHost ] const instanceMethods = [ isOwned, @@ -355,16 +351,6 @@ getPublicKeyUrl = function (this: AccountInstance) { // ------------------------------ STATICS ------------------------------ -listOwned = function () { - const query: Sequelize.FindOptions = { - where: { - serverId: null - } - } - - return Account.findAll(query) -} - loadApplication = function () { return Account.findOne({ include: [ @@ -441,15 +427,3 @@ loadByUrl = function (url: string, transaction?: Sequelize.Transaction) { return Account.findOne(query) } - -loadAccountByServerAndUUID = function (uuid: string, serverId: number, transaction: Sequelize.Transaction) { - const query: Sequelize.FindOptions = { - where: { - serverId, - uuid - }, - transaction - } - - return Account.find(query) -} -- cgit v1.2.3