]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user-video-history.ts
Stronger model typings
[github/Chocobozzz/PeerTube.git] / server / models / account / user-video-history.ts
index a862fc45fb859b0d842877c888b76233aec0962a..3fe4c8db1c8823921c9e5b07209e58e799f7a5ec 100644 (file)
@@ -1,7 +1,8 @@
 import { AllowNull, BelongsTo, Column, CreatedAt, ForeignKey, IsInt, Model, Table, UpdatedAt } from 'sequelize-typescript'
 import { VideoModel } from '../video/video'
 import { UserModel } from './user'
-import { Transaction, Op, DestroyOptions } from 'sequelize'
+import { DestroyOptions, Op, Transaction } from 'sequelize'
+import { MUserAccountId, MUserId } from '@server/typings/models'
 
 @Table({
   tableName: 'userVideoHistory',
@@ -54,7 +55,7 @@ export class UserVideoHistoryModel extends Model<UserVideoHistoryModel> {
   })
   User: UserModel
 
-  static listForApi (user: UserModel, start: number, count: number) {
+  static listForApi (user: MUserAccountId, start: number, count: number) {
     return VideoModel.listForApi({
       start,
       count,
@@ -67,7 +68,7 @@ export class UserVideoHistoryModel extends Model<UserVideoHistoryModel> {
     })
   }
 
-  static removeUserHistoryBefore (user: UserModel, beforeDate: string, t: Transaction) {
+  static removeUserHistoryBefore (user: MUserId, beforeDate: string, t: Transaction) {
     const query: DestroyOptions = {
       where: {
         userId: user.id