1
0
Fork 0
peertube/server/models/video/author-interface.ts

46 lines
1.5 KiB
TypeScript
Raw Normal View History

2017-05-22 14:58:25 -04:00
import * as Sequelize from 'sequelize'
import * as Promise from 'bluebird'
2017-05-22 14:58:25 -04:00
2017-09-07 09:27:35 -04:00
import { PodInstance } from '../pod/pod-interface'
2017-10-24 13:41:09 -04:00
import { RemoteVideoAuthorCreateData } from '../../../shared/models/pods/remote-video/remote-video-author-create-request.model'
import { VideoChannelInstance } from './video-channel-interface'
2017-06-10 16:15:25 -04:00
2017-05-22 14:58:25 -04:00
export namespace AuthorMethods {
2017-10-24 13:41:09 -04:00
export type Load = (id: number) => Promise<AuthorInstance>
export type LoadByUUID = (uuid: string) => Promise<AuthorInstance>
export type LoadAuthorByPodAndUUID = (uuid: string, podId: number, transaction: Sequelize.Transaction) => Promise<AuthorInstance>
export type ListOwned = () => Promise<AuthorInstance[]>
export type ToAddRemoteJSON = (this: AuthorInstance) => RemoteVideoAuthorCreateData
export type IsOwned = (this: AuthorInstance) => boolean
2017-05-22 14:58:25 -04:00
}
export interface AuthorClass {
2017-10-24 13:41:09 -04:00
loadAuthorByPodAndUUID: AuthorMethods.LoadAuthorByPodAndUUID
load: AuthorMethods.Load
loadByUUID: AuthorMethods.LoadByUUID
listOwned: AuthorMethods.ListOwned
2017-05-22 14:58:25 -04:00
}
export interface AuthorAttributes {
name: string
2017-10-24 13:41:09 -04:00
uuid?: string
podId?: number
userId?: number
2017-05-22 14:58:25 -04:00
}
export interface AuthorInstance extends AuthorClass, AuthorAttributes, Sequelize.Instance<AuthorAttributes> {
2017-10-24 13:41:09 -04:00
isOwned: AuthorMethods.IsOwned
toAddRemoteJSON: AuthorMethods.ToAddRemoteJSON
2017-05-22 14:58:25 -04:00
id: number
createdAt: Date
updatedAt: Date
2017-06-10 16:15:25 -04:00
Pod: PodInstance
2017-10-24 13:41:09 -04:00
VideoChannels: VideoChannelInstance[]
2017-05-22 14:58:25 -04:00
}
export interface AuthorModel extends AuthorClass, Sequelize.Model<AuthorInstance, AuthorAttributes> {}