]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/account/account-interface.ts
Add follow tabs
[github/Chocobozzz/PeerTube.git] / server / models / account / account-interface.ts
CommitLineData
e4f97bab 1import * as Bluebird from 'bluebird'
7a7724e6
C
2import * as Sequelize from 'sequelize'
3import { Account as FormattedAccount, ActivityPubActor } from '../../../shared'
4import { ResultList } from '../../../shared/models/result-list.model'
e4f97bab
C
5import { PodInstance } from '../pod/pod-interface'
6import { VideoChannelInstance } from '../video/video-channel-interface'
e4f97bab
C
7
8export namespace AccountMethods {
7a7724e6
C
9 export type LoadApplication = () => Bluebird<AccountInstance>
10
e4f97bab
C
11 export type Load = (id: number) => Bluebird<AccountInstance>
12 export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance>
ce548a10 13 export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance>
e4f97bab 14 export type LoadAccountByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Bluebird<AccountInstance>
350e31d6
C
15 export type LoadLocalByName = (name: string) => Bluebird<AccountInstance>
16 export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance>
e4f97bab 17 export type ListOwned = () => Bluebird<AccountInstance[]>
e4f97bab
C
18
19 export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor
7a7724e6 20 export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount
e4f97bab
C
21 export type IsOwned = (this: AccountInstance) => boolean
22 export type GetFollowerSharedInboxUrls = (this: AccountInstance) => Bluebird<string[]>
23 export type GetFollowingUrl = (this: AccountInstance) => string
24 export type GetFollowersUrl = (this: AccountInstance) => string
25 export type GetPublicKeyUrl = (this: AccountInstance) => string
26}
27
28export interface AccountClass {
7a7724e6 29 loadApplication: AccountMethods.LoadApplication
e4f97bab
C
30 loadAccountByPodAndUUID: AccountMethods.LoadAccountByPodAndUUID
31 load: AccountMethods.Load
32 loadByUUID: AccountMethods.LoadByUUID
33 loadByUrl: AccountMethods.LoadByUrl
350e31d6
C
34 loadLocalByName: AccountMethods.LoadLocalByName
35 loadByNameAndHost: AccountMethods.LoadByNameAndHost
e4f97bab 36 listOwned: AccountMethods.ListOwned
e4f97bab
C
37}
38
39export interface AccountAttributes {
40 name: string
41 url: string
42 publicKey: string
43 privateKey: string
44 followersCount: number
45 followingCount: number
46 inboxUrl: string
47 outboxUrl: string
48 sharedInboxUrl: string
49 followersUrl: string
50 followingUrl: string
51
52 uuid?: string
53
54 podId?: number
55 userId?: number
56 applicationId?: number
57}
58
59export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> {
60 isOwned: AccountMethods.IsOwned
61 toActivityPubObject: AccountMethods.ToActivityPubObject
7a7724e6 62 toFormattedJSON: AccountMethods.ToFormattedJSON
e4f97bab
C
63 getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls
64 getFollowingUrl: AccountMethods.GetFollowingUrl
65 getFollowersUrl: AccountMethods.GetFollowersUrl
66 getPublicKeyUrl: AccountMethods.GetPublicKeyUrl
67
68 id: number
69 createdAt: Date
70 updatedAt: Date
71
72 Pod: PodInstance
73 VideoChannels: VideoChannelInstance[]
74}
75
76export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {}