aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/account-follow-interface.ts
blob: 7975a46f32f47b6be10442e877091e8293851c96 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import * as Bluebird from 'bluebird'
import * as Sequelize from 'sequelize'
import { AccountFollow, FollowState } from '../../../shared/models/accounts/follow.model'
import { ResultList } from '../../../shared/models/result-list.model'
import { AccountInstance } from './account-interface'

export namespace AccountFollowMethods {
  export type LoadByAccountAndTarget = (
    accountId: number,
    targetAccountId: number,
    t?: Sequelize.Transaction
  ) => Bluebird<AccountFollowInstance>

  export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>
  export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>

  export type ListAcceptedFollowerUrlsForApi = (
    accountId: number[],
    t: Sequelize.Transaction,
    start?: number,
    count?: number
  ) => Promise< ResultList<string> >
  export type ListAcceptedFollowingUrlsForApi = (
    accountId: number[],
    t: Sequelize.Transaction,
    start?: number,
    count?: number
  ) => Promise< ResultList<string> >
  export type ListAcceptedFollowerSharedInboxUrls = (accountId: number[], t: Sequelize.Transaction) => Promise< ResultList<string> >
  export type ToFormattedJSON = (this: AccountFollowInstance) => AccountFollow
}

export interface AccountFollowClass {
  loadByAccountAndTarget: AccountFollowMethods.LoadByAccountAndTarget
  listFollowersForApi: AccountFollowMethods.ListFollowersForApi
  listFollowingForApi: AccountFollowMethods.ListFollowingForApi

  listAcceptedFollowerUrlsForApi: AccountFollowMethods.ListAcceptedFollowerUrlsForApi
  listAcceptedFollowingUrlsForApi: AccountFollowMethods.ListAcceptedFollowingUrlsForApi
  listAcceptedFollowerSharedInboxUrls: AccountFollowMethods.ListAcceptedFollowerSharedInboxUrls
}

export interface AccountFollowAttributes {
  accountId: number
  targetAccountId: number
  state: FollowState
}

export interface AccountFollowInstance extends AccountFollowClass, AccountFollowAttributes, Sequelize.Instance<AccountFollowAttributes> {
  id: number
  createdAt: Date
  updatedAt: Date

  AccountFollower?: AccountInstance
  AccountFollowing?: AccountInstance

  toFormattedJSON: AccountFollowMethods.ToFormattedJSON
}

export interface AccountFollowModel extends AccountFollowClass, Sequelize.Model<AccountFollowInstance, AccountFollowAttributes> {}