]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/video/video-blacklist-interface.ts
Formated -> Formatted
[github/Chocobozzz/PeerTube.git] / server / models / video / video-blacklist-interface.ts
index 37f579422f193e0a98405a63b067089cb06009dc..ba48b1b6e0abc3b53af521f0809ab6efd1fdd4b2 100644 (file)
@@ -1,29 +1,27 @@
 import * as Sequelize from 'sequelize'
+import * as Promise from 'bluebird'
+
+import { ResultList } from '../../../shared'
 
 // Don't use barrel, import just what we need
-import { BlacklistedVideo as FormatedBlacklistedVideo } from '../../../shared/models/video-blacklist.model'
+import { BlacklistedVideo as FormattedBlacklistedVideo } from '../../../shared/models/videos/video-blacklist.model'
 
 export namespace BlacklistedVideoMethods {
-  export type ToFormatedJSON = () => FormatedBlacklistedVideo
+  export type ToFormattedJSON = (this: BlacklistedVideoInstance) => FormattedBlacklistedVideo
 
-  export type CountTotalCallback = (err: Error, total: number) => void
-  export type CountTotal = (callback: CountTotalCallback) => void
+  export type CountTotal = () => Promise<number>
 
-  export type ListCallback = (err: Error, backlistedVideoInstances: BlacklistedVideoInstance[]) => void
-  export type List = (callback: ListCallback) => void
+  export type List = () => Promise<BlacklistedVideoInstance[]>
 
-  export type ListForApiCallback = (err: Error, blacklistedVIdeoInstances?: BlacklistedVideoInstance[], total?: number) => void
-  export type ListForApi = (start: number, count: number, sort: string, callback: ListForApiCallback) => void
+  export type ListForApi = (start: number, count: number, sort: string) => Promise< ResultList<BlacklistedVideoInstance> >
 
-  export type LoadByIdCallback = (err: Error, blacklistedVideoInstance: BlacklistedVideoInstance) => void
-  export type LoadById = (id: number, callback: LoadByIdCallback) => void
+  export type LoadById = (id: number) => Promise<BlacklistedVideoInstance>
 
-  export type LoadByVideoIdCallback = (err: Error, blacklistedVideoInstance: BlacklistedVideoInstance) => void
-  export type LoadByVideoId = (id: string, callback: LoadByVideoIdCallback) => void
+  export type LoadByVideoId = (id: number) => Promise<BlacklistedVideoInstance>
 }
 
 export interface BlacklistedVideoClass {
-  toFormatedJSON: BlacklistedVideoMethods.ToFormatedJSON
+  toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON
   countTotal: BlacklistedVideoMethods.CountTotal
   list: BlacklistedVideoMethods.List
   listForApi: BlacklistedVideoMethods.ListForApi
@@ -32,12 +30,17 @@ export interface BlacklistedVideoClass {
 }
 
 export interface BlacklistedVideoAttributes {
+  videoId: number
 }
 
-export interface BlacklistedVideoInstance extends BlacklistedVideoClass, BlacklistedVideoAttributes, Sequelize.Instance<BlacklistedVideoAttributes> {
+export interface BlacklistedVideoInstance
+  extends BlacklistedVideoClass, BlacklistedVideoAttributes, Sequelize.Instance<BlacklistedVideoAttributes> {
   id: number
   createdAt: Date
   updatedAt: Date
+
+  toFormattedJSON: BlacklistedVideoMethods.ToFormattedJSON
 }
 
-export interface BlacklistedVideoModel extends BlacklistedVideoClass, Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes> {}
+export interface BlacklistedVideoModel
+  extends BlacklistedVideoClass, Sequelize.Model<BlacklistedVideoInstance, BlacklistedVideoAttributes> {}