import * as Bluebird from 'bluebird'
import * as Sequelize from 'sequelize'
import { Account as FormattedAccount, ActivityPubActor } from '../../../shared'
-import { ResultList } from '../../../shared/models/result-list.model'
-import { PodInstance } from '../pod/pod-interface'
+import { ServerInstance } from '../server/server-interface'
import { VideoChannelInstance } from '../video/video-channel-interface'
export namespace AccountMethods {
export type Load = (id: number) => Bluebird<AccountInstance>
export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
- export type LoadByUrl = (url: string) => Bluebird<AccountInstance>
- export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
- export type LoadLocalAccountByNameAndPod = (name: string, host: string) => Bluebird<AccountInstance>
- export type ListOwned = () => Bluebird<AccountInstance[]>
- export type ListFollowerUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
- export type ListFollowingUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
- export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
- export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
+ export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance>
+ export type LoadLocalByName = (name: string) => Bluebird<AccountInstance>
+ export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
+ export type ListByFollowersUrls = (followerUrls: string[], transaction: Sequelize.Transaction) => Bluebird<AccountInstance[]>
export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
export type IsOwned = (this: AccountInstance) => boolean
- export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
+ export type GetFollowerSharedInboxUrls = (this: AccountInstance, t: Sequelize.Transaction) => Bluebird<string[]>
export type GetFollowingUrl = (this: AccountInstance) => string
export type GetFollowersUrl = (this: AccountInstance) => string
export type GetPublicKeyUrl = (this: AccountInstance) => string
export interface AccountClass {
loadApplication: AccountMethods.LoadApplication
- loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID
load: AccountMethods.Load
loadByUUID: AccountMethods.LoadByUUID
loadByUrl: AccountMethods.LoadByUrl
- loadLocalAccountByNameAndPod: AccountMethods.LoadLocalAccountByNameAndPod
- listOwned: AccountMethods.ListOwned
- listFollowerUrlsForApi: AccountMethods.ListFollowerUrlsForApi
- listFollowingUrlsForApi: AccountMethods.ListFollowingUrlsForApi
- listFollowingForApi: AccountMethods.ListFollowingForApi
- listFollowersForApi: AccountMethods.ListFollowersForApi
+ loadLocalByName: AccountMethods.LoadLocalByName
+ loadByNameAndHost: AccountMethods.LoadByNameAndHost
+ listByFollowersUrls: AccountMethods.ListByFollowersUrls
}
export interface AccountAttributes {
name: string
- url: string
+ url?: string
publicKey: string
privateKey: string
followersCount: number
uuid?: string
- podId?: number
+ serverId?: number
userId?: number
applicationId?: number
}
createdAt: Date
updatedAt: Date
- Pod: PodInstance
+ Server: ServerInstance
VideoChannels: VideoChannelInstance[]
}