]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - server/models/account/account-follow-interface.ts
Add follow tabs
[github/Chocobozzz/PeerTube.git] / server / models / account / account-follow-interface.ts
... / ...
CommitLineData
1import * as Sequelize from 'sequelize'
2import * as Bluebird from 'bluebird'
3import { FollowState } from '../../../shared/models/accounts/follow.model'
4import { ResultList } from '../../../shared/models/result-list.model'
5import { AccountInstance } from './account-interface'
6
7export namespace AccountFollowMethods {
8 export type LoadByAccountAndTarget = (accountId: number, targetAccountId: number) => Bluebird<AccountFollowInstance>
9
10 export type ListFollowingForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
11 export type ListFollowersForApi = (id: number, start: number, count: number, sort: string) => Bluebird< ResultList<AccountInstance> >
12
13 export type ListAcceptedFollowerUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
14 export type ListAcceptedFollowingUrlsForApi = (id: number, start: number, count?: number) => Promise< ResultList<string> >
15}
16
17export interface AccountFollowClass {
18 loadByAccountAndTarget: AccountFollowMethods.LoadByAccountAndTarget
19 listFollowersForApi: AccountFollowMethods.ListFollowersForApi
20 listFollowingForApi: AccountFollowMethods.ListFollowingForApi
21
22 listAcceptedFollowerUrlsForApi: AccountFollowMethods.ListAcceptedFollowerUrlsForApi
23 listAcceptedFollowingUrlsForApi: AccountFollowMethods.ListAcceptedFollowingUrlsForApi
24}
25
26export interface AccountFollowAttributes {
27 accountId: number
28 targetAccountId: number
29 state: FollowState
30}
31
32export interface AccountFollowInstance extends AccountFollowClass, AccountFollowAttributes, Sequelize.Instance<AccountFollowAttributes> {
33 id: number
34 createdAt: Date
35 updatedAt: Date
36
37 AccountFollower?: AccountInstance
38 AccountFollowing?: AccountInstance
39}
40
41export interface AccountFollowModel extends AccountFollowClass, Sequelize.Model<AccountFollowInstance, AccountFollowAttributes> {}