]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/account-video-rate.ts
Add auth plugin info in users list
[github/Chocobozzz/PeerTube.git] / server / models / account / account-video-rate.ts
index 8b62dd05ff9b833a4f0c94ba48853a46564fa670..8aeb486d1fef684e65033d4028c1b500b649ad19 100644 (file)
@@ -11,7 +11,12 @@ import { isActivityPubUrlValid } from '../../helpers/custom-validators/activityp
 import { AccountVideoRate } from '../../../shared'
 import { ScopeNames as VideoChannelScopeNames, SummaryOptions, VideoChannelModel } from '../video/video-channel'
 import * as Bluebird from 'bluebird'
-import { MAccountVideoRate, MAccountVideoRateAccountUrl, MAccountVideoRateAccountVideo } from '@server/typings/models/video/video-rate'
+import {
+  MAccountVideoRate,
+  MAccountVideoRateAccountUrl,
+  MAccountVideoRateAccountVideo,
+  MAccountVideoRateFormattable
+} from '@server/typings/models/video/video-rate'
 
 /*
   Account rates per video.
@@ -94,7 +99,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
   static loadByAccountAndVideoOrUrl (accountId: number, videoId: number, url: string, t?: Transaction): Bluebird<MAccountVideoRate> {
     const options: FindOptions = {
       where: {
-        [ Op.or]: [
+        [Op.or]: [
           {
             accountId,
             videoId
@@ -111,10 +116,10 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
   }
 
   static listByAccountForApi (options: {
-    start: number,
-    count: number,
-    sort: string,
-    type?: string,
+    start: number
+    count: number
+    sort: string
+    type?: string
     accountId: number
   }) {
     const query: FindOptions = {
@@ -130,7 +135,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
           required: true,
           include: [
             {
-              model: VideoChannelModel.scope({ method: [VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),
+              model: VideoChannelModel.scope({ method: [ VideoChannelScopeNames.SUMMARY, { withAccount: true } as SummaryOptions ] }),
               required: true
             }
           ]
@@ -145,7 +150,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
   static loadLocalAndPopulateVideo (
     rateType: VideoRateType,
     accountName: string,
-    videoId: number,
+    videoId: number | string,
     t?: Transaction
   ): Bluebird<MAccountVideoRateAccountVideo> {
     const options: FindOptions = {
@@ -248,7 +253,7 @@ export class AccountVideoRateModel extends Model<AccountVideoRateModel> {
     })
   }
 
-  toFormattedJSON (): AccountVideoRate {
+  toFormattedJSON (this: MAccountVideoRateFormattable): AccountVideoRate {
     return {
       video: this.Video.toFormattedJSON(),
       rating: this.type