]>
Commit | Line | Data |
---|---|---|
1 | import * as Sequelize from 'sequelize' | |
2 | import * as Promise from 'bluebird' | |
3 | ||
4 | import { PodInstance } from '../pod/pod-interface' | |
5 | import { RemoteVideoAuthorCreateData } from '../../../shared/models/pods/remote-video/remote-video-author-create-request.model' | |
6 | import { VideoChannelInstance } from './video-channel-interface' | |
7 | ||
8 | export namespace AuthorMethods { | |
9 | export type Load = (id: number) => Promise<AuthorInstance> | |
10 | export type LoadByUUID = (uuid: string) => Promise<AuthorInstance> | |
11 | export type LoadAuthorByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Promise<AuthorInstance> | |
12 | export type ListOwned = () => Promise<AuthorInstance[]> | |
13 | ||
14 | export type ToAddRemoteJSON = (this: AuthorInstance) => RemoteVideoAuthorCreateData | |
15 | export type IsOwned = (this: AuthorInstance) => boolean | |
16 | } | |
17 | ||
18 | export interface AuthorClass { | |
19 | loadAuthorByPodAndUUID: AuthorMethods.LoadAuthorByPodAndUUID | |
20 | load: AuthorMethods.Load | |
21 | loadByUUID: AuthorMethods.LoadByUUID | |
22 | listOwned: AuthorMethods.ListOwned | |
23 | } | |
24 | ||
25 | export interface AuthorAttributes { | |
26 | name: string | |
27 | uuid?: string | |
28 | ||
29 | podId?: number | |
30 | userId?: number | |
31 | } | |
32 | ||
33 | export interface AuthorInstance extends AuthorClass, AuthorAttributes, Sequelize.Instance<AuthorAttributes> { | |
34 | isOwned: AuthorMethods.IsOwned | |
35 | toAddRemoteJSON: AuthorMethods.ToAddRemoteJSON | |
36 | ||
37 | id: number | |
38 | createdAt: Date | |
39 | updatedAt: Date | |
40 | ||
41 | Pod: PodInstance | |
42 | VideoChannels: VideoChannelInstance[] | |
43 | } | |
44 | ||
45 | export interface AuthorModel extends AuthorClass, Sequelize.Model<AuthorInstance, AuthorAttributes> {} |