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