]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
refactor 404 page
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
index e850d1e6df311c4a45b1a054b73e33faa4cbe920..10117099b6283d8e09a22ee492eaeca4b3be7603 100644 (file)
@@ -19,14 +19,14 @@ import {
   Model,
   Scopes,
   Table,
-  UpdatedAt
+  UpdatedAt,
+  IsUUID
 } from 'sequelize-typescript'
 import {
   MMyUserFormattable,
   MUser,
   MUserDefault,
   MUserFormattable,
-  MUserId,
   MUserNotifSettingChannelDefault,
   MUserWithNotificationSetting,
   MVideoFullLight
@@ -68,10 +68,10 @@ import { getSort, throwIfNotValid } from '../utils'
 import { VideoModel } from '../video/video'
 import { VideoChannelModel } from '../video/video-channel'
 import { VideoImportModel } from '../video/video-import'
+import { VideoLiveModel } from '../video/video-live'
 import { VideoPlaylistModel } from '../video/video-playlist'
 import { AccountModel } from './account'
 import { UserNotificationSettingModel } from './user-notification-setting'
-import { VideoLiveModel } from '../video/video-live'
 
 enum ScopeNames {
   FOR_ME_API = 'FOR_ME_API',
@@ -354,6 +354,12 @@ export class UserModel extends Model<UserModel> {
   @Column
   pluginAuth: string
 
+  @AllowNull(false)
+  @Default(DataType.UUIDV4)
+  @IsUUID(4)
+  @Column(DataType.UUID)
+  feedToken: string
+
   @AllowNull(true)
   @Default(null)
   @Column
@@ -710,7 +716,7 @@ export class UserModel extends Model<UserModel> {
                   required: true,
                   include: [
                     {
-                      attributes: [ 'id', 'videoId' ],
+                      attributes: [],
                       model: VideoLiveModel.unscoped(),
                       required: true,
                       where: {
@@ -726,7 +732,7 @@ export class UserModel extends Model<UserModel> {
       ]
     }
 
-    return UserModel.findOne(query)
+    return UserModel.unscoped().findOne(query)
   }
 
   static generateUserQuotaBaseSQL (options: {