diff options
Diffstat (limited to 'server/models/video/author-interface.ts')
-rw-r--r-- | server/models/video/author-interface.ts | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/server/models/video/author-interface.ts b/server/models/video/author-interface.ts index 52a00a1d3..fc69ff3c2 100644 --- a/server/models/video/author-interface.ts +++ b/server/models/video/author-interface.ts | |||
@@ -2,31 +2,44 @@ import * as Sequelize from 'sequelize' | |||
2 | import * as Promise from 'bluebird' | 2 | import * as Promise from 'bluebird' |
3 | 3 | ||
4 | import { PodInstance } from '../pod/pod-interface' | 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' | ||
5 | 7 | ||
6 | export namespace AuthorMethods { | 8 | export namespace AuthorMethods { |
7 | export type FindOrCreateAuthor = ( | 9 | export type Load = (id: number) => Promise<AuthorInstance> |
8 | name: string, | 10 | export type LoadByUUID = (uuid: string) => Promise<AuthorInstance> |
9 | podId: number, | 11 | export type LoadAuthorByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Promise<AuthorInstance> |
10 | userId: number, | 12 | export type ListOwned = () => Promise<AuthorInstance[]> |
11 | transaction: Sequelize.Transaction | 13 | |
12 | ) => Promise<AuthorInstance> | 14 | export type ToAddRemoteJSON = (this: AuthorInstance) => RemoteVideoAuthorCreateData |
15 | export type IsOwned = (this: AuthorInstance) => boolean | ||
13 | } | 16 | } |
14 | 17 | ||
15 | export interface AuthorClass { | 18 | export interface AuthorClass { |
16 | findOrCreateAuthor: AuthorMethods.FindOrCreateAuthor | 19 | loadAuthorByPodAndUUID: AuthorMethods.LoadAuthorByPodAndUUID |
20 | load: AuthorMethods.Load | ||
21 | loadByUUID: AuthorMethods.LoadByUUID | ||
22 | listOwned: AuthorMethods.ListOwned | ||
17 | } | 23 | } |
18 | 24 | ||
19 | export interface AuthorAttributes { | 25 | export interface AuthorAttributes { |
20 | name: string | 26 | name: string |
27 | uuid?: string | ||
28 | |||
29 | podId?: number | ||
30 | userId?: number | ||
21 | } | 31 | } |
22 | 32 | ||
23 | export interface AuthorInstance extends AuthorClass, AuthorAttributes, Sequelize.Instance<AuthorAttributes> { | 33 | export interface AuthorInstance extends AuthorClass, AuthorAttributes, Sequelize.Instance<AuthorAttributes> { |
34 | isOwned: AuthorMethods.IsOwned | ||
35 | toAddRemoteJSON: AuthorMethods.ToAddRemoteJSON | ||
36 | |||
24 | id: number | 37 | id: number |
25 | createdAt: Date | 38 | createdAt: Date |
26 | updatedAt: Date | 39 | updatedAt: Date |
27 | 40 | ||
28 | podId: number | ||
29 | Pod: PodInstance | 41 | Pod: PodInstance |
42 | VideoChannels: VideoChannelInstance[] | ||
30 | } | 43 | } |
31 | 44 | ||
32 | export interface AuthorModel extends AuthorClass, Sequelize.Model<AuthorInstance, AuthorAttributes> {} | 45 | export interface AuthorModel extends AuthorClass, Sequelize.Model<AuthorInstance, AuthorAttributes> {} |