X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Faccount-interface.ts;h=1a567fb7a8802cd1242bef0985ab5e24c8d9c638;hb=59c857da5961e2bcddcfd07832783c1e4afcd01a;hp=2ef3e2246c53221ee7e5030e7eb43e5797244223;hpb=e4f97babf701481b55cc10fb3448feab5f97c867;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/account-interface.ts b/server/models/account/account-interface.ts index 2ef3e2246..1a567fb7a 100644 --- a/server/models/account/account-interface.ts +++ b/server/models/account/account-interface.ts @@ -1,22 +1,22 @@ -import * as Sequelize from 'sequelize' import * as Bluebird from 'bluebird' - -import { PodInstance } from '../pod/pod-interface' +import * as Sequelize from 'sequelize' +import { Account as FormattedAccount, ActivityPubActor } from '../../../shared' +import { ServerInstance } from '../server/server-interface' import { VideoChannelInstance } from '../video/video-channel-interface' -import { ActivityPubActor } from '../../../shared' -import { ResultList } from '../../../shared/models/result-list.model' export namespace AccountMethods { + export type LoadApplication = () => Bluebird + export type Load = (id: number) => Bluebird export type LoadByUUID = (uuid: string) => Bluebird - export type LoadByUrl = (url: string) => Bluebird - export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird - export type LoadLocalAccountByName = (name: 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 ListFollowerUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList > - export type ListFollowingUrlsForApi = (name: string, start: number, count: number) => Promise< ResultList > export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor + export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount export type IsOwned = (this: AccountInstance) => boolean export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird export type GetFollowingUrl = (this: AccountInstance) => string @@ -25,14 +25,14 @@ export namespace AccountMethods { } export interface AccountClass { - loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID + loadApplication: AccountMethods.LoadApplication + loadAccountByServerAndUUID: AccountMethods.LoadAccountByServerAndUUID load: AccountMethods.Load loadByUUID: AccountMethods.LoadByUUID loadByUrl: AccountMethods.LoadByUrl - loadLocalAccountByName: AccountMethods.LoadLocalAccountByName + loadLocalByName: AccountMethods.LoadLocalByName + loadByNameAndHost: AccountMethods.LoadByNameAndHost listOwned: AccountMethods.ListOwned - listFollowerUrlsForApi: AccountMethods.ListFollowerUrlsForApi - listFollowingUrlsForApi: AccountMethods.ListFollowingUrlsForApi } export interface AccountAttributes { @@ -50,7 +50,7 @@ export interface AccountAttributes { uuid?: string - podId?: number + serverId?: number userId?: number applicationId?: number } @@ -58,6 +58,7 @@ export interface AccountAttributes { export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance { isOwned: AccountMethods.IsOwned toActivityPubObject: AccountMethods.ToActivityPubObject + toFormattedJSON: AccountMethods.ToFormattedJSON getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls getFollowingUrl: AccountMethods.GetFollowingUrl getFollowersUrl: AccountMethods.GetFollowersUrl @@ -67,7 +68,7 @@ export interface AccountInstance extends AccountClass, AccountAttributes, Sequel createdAt: Date updatedAt: Date - Pod: PodInstance + Server: ServerInstance VideoChannels: VideoChannelInstance[] }