]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/models/account/account-follow-interface.ts
Optimise transaction for video upload
[github/Chocobozzz/PeerTube.git] / server / models / account / account-follow-interface.ts
CommitLineData
7a7724e6 1import * as Bluebird from 'bluebird'
7e9334c3
C
2import * as Sequelize from 'sequelize'
3import { AccountFollow, FollowState } from '../../../shared/models/accounts/follow.model'
51548b31
C
4import { ResultList } from '../../../shared/models/result-list.model'
5import { AccountInstance } from './account-interface'
e4f97bab
C
6
7export namespace AccountFollowMethods {
0032ebe9
C
8 export type LoadByAccountAndTarget = (
9 accountId: number,
10 targetAccountId: number,
11 t?: Sequelize.Transaction
12 ) => Bluebird<AccountFollowInstance>
51548b31 13
7e9334c3
C
14 export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>
15 export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountFollowInstance>>
51548b31 16
25ed141c
C
17 export type ListAcceptedFollowerUrlsForApi = (
18 accountId: number[],
19 t: Sequelize.Transaction,
20 start?: number,
21 count?: number
22 ) => Promise< ResultList<string> >
23 export type ListAcceptedFollowingUrlsForApi = (
24 accountId: number[],
25 t: Sequelize.Transaction,
26 start?: number,
27 count?: number
28 ) => Promise< ResultList<string> >
29 export type ListAcceptedFollowerSharedInboxUrls = (accountId: number[], t: Sequelize.Transaction) => Promise< ResultList<string> >
7e9334c3 30 export type ToFormattedJSON = (this: AccountFollowInstance) => AccountFollow
e4f97bab
C
31}
32
33export interface AccountFollowClass {
7a7724e6 34 loadByAccountAndTarget: AccountFollowMethods.LoadByAccountAndTarget
51548b31
C
35 listFollowersForApi: AccountFollowMethods.ListFollowersForApi
36 listFollowingForApi: AccountFollowMethods.ListFollowingForApi
37
38 listAcceptedFollowerUrlsForApi: AccountFollowMethods.ListAcceptedFollowerUrlsForApi
39 listAcceptedFollowingUrlsForApi: AccountFollowMethods.ListAcceptedFollowingUrlsForApi
efc32059 40 listAcceptedFollowerSharedInboxUrls: AccountFollowMethods.ListAcceptedFollowerSharedInboxUrls
e4f97bab
C
41}
42
43export interface AccountFollowAttributes {
44 accountId: number
45 targetAccountId: number
7a7724e6 46 state: FollowState
e4f97bab
C
47}
48
49export interface AccountFollowInstance extends AccountFollowClass, AccountFollowAttributes, Sequelize.Instance<AccountFollowAttributes> {
50 id: number
51 createdAt: Date
52 updatedAt: Date
51548b31
C
53
54 AccountFollower?: AccountInstance
55 AccountFollowing?: AccountInstance
7e9334c3
C
56
57 toFormattedJSON: AccountFollowMethods.ToFormattedJSON
e4f97bab
C
58}
59
60export interface AccountFollowModel extends AccountFollowClass, Sequelize.Model<AccountFollowInstance, AccountFollowAttributes> {}