]>
Commit | Line | Data |
---|---|---|
e4f97bab | 1 | import * as Bluebird from 'bluebird' |
7a7724e6 C |
2 | import * as Sequelize from 'sequelize' |
3 | import { Account as FormattedAccount, ActivityPubActor } from '../../../shared' | |
60862425 | 4 | import { ServerInstance } from '../server/server-interface' |
e4f97bab | 5 | import { VideoChannelInstance } from '../video/video-channel-interface' |
e4f97bab C |
6 | |
7 | export namespace AccountMethods { | |
7a7724e6 C |
8 | export type LoadApplication = () => Bluebird<AccountInstance> |
9 | ||
e4f97bab C |
10 | export type Load = (id: number) => Bluebird<AccountInstance> |
11 | export type LoadByUUID = (uuid: string) => Bluebird<AccountInstance> | |
ce548a10 | 12 | export type LoadByUrl = (url: string, transaction?: Sequelize.Transaction) => Bluebird<AccountInstance> |
350e31d6 C |
13 | export type LoadLocalByName = (name: string) => Bluebird<AccountInstance> |
14 | export type LoadByNameAndHost = (name: string, host: string) => Bluebird<AccountInstance> | |
25ed141c | 15 | export type ListByFollowersUrls = (followerUrls: string[], transaction: Sequelize.Transaction) => Bluebird<AccountInstance[]> |
e4f97bab C |
16 | |
17 | export type ToActivityPubObject = (this: AccountInstance) => ActivityPubActor | |
7a7724e6 | 18 | export type ToFormattedJSON = (this: AccountInstance) => FormattedAccount |
e4f97bab | 19 | export type IsOwned = (this: AccountInstance) => boolean |
25ed141c | 20 | export type GetFollowerSharedInboxUrls = (this: AccountInstance, t: Sequelize.Transaction) => Bluebird<string[]> |
e4f97bab C |
21 | export type GetFollowingUrl = (this: AccountInstance) => string |
22 | export type GetFollowersUrl = (this: AccountInstance) => string | |
23 | export type GetPublicKeyUrl = (this: AccountInstance) => string | |
24 | } | |
25 | ||
26 | export interface AccountClass { | |
7a7724e6 | 27 | loadApplication: AccountMethods.LoadApplication |
e4f97bab C |
28 | load: AccountMethods.Load |
29 | loadByUUID: AccountMethods.LoadByUUID | |
30 | loadByUrl: AccountMethods.LoadByUrl | |
350e31d6 C |
31 | loadLocalByName: AccountMethods.LoadLocalByName |
32 | loadByNameAndHost: AccountMethods.LoadByNameAndHost | |
63c93323 | 33 | listByFollowersUrls: AccountMethods.ListByFollowersUrls |
e4f97bab C |
34 | } |
35 | ||
36 | export interface AccountAttributes { | |
37 | name: string | |
54141398 | 38 | url?: string |
e4f97bab C |
39 | publicKey: string |
40 | privateKey: string | |
41 | followersCount: number | |
42 | followingCount: number | |
43 | inboxUrl: string | |
44 | outboxUrl: string | |
45 | sharedInboxUrl: string | |
46 | followersUrl: string | |
47 | followingUrl: string | |
48 | ||
49 | uuid?: string | |
50 | ||
60862425 | 51 | serverId?: number |
e4f97bab C |
52 | userId?: number |
53 | applicationId?: number | |
54 | } | |
55 | ||
56 | export interface AccountInstance extends AccountClass, AccountAttributes, Sequelize.Instance<AccountAttributes> { | |
57 | isOwned: AccountMethods.IsOwned | |
58 | toActivityPubObject: AccountMethods.ToActivityPubObject | |
7a7724e6 | 59 | toFormattedJSON: AccountMethods.ToFormattedJSON |
e4f97bab C |
60 | getFollowerSharedInboxUrls: AccountMethods.GetFollowerSharedInboxUrls |
61 | getFollowingUrl: AccountMethods.GetFollowingUrl | |
62 | getFollowersUrl: AccountMethods.GetFollowersUrl | |
63 | getPublicKeyUrl: AccountMethods.GetPublicKeyUrl | |
64 | ||
65 | id: number | |
66 | createdAt: Date | |
67 | updatedAt: Date | |
68 | ||
60862425 | 69 | Server: ServerInstance |
e4f97bab C |
70 | VideoChannels: VideoChannelInstance[] |
71 | } | |
72 | ||
73 | export interface AccountModel extends AccountClass, Sequelize.Model<AccountInstance, AccountAttributes> {} |