]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/user/user-notification-setting.ts
Refactor model utils
[github/Chocobozzz/PeerTube.git] / server / models / user / user-notification-setting.ts
index bee7d7851583a8bc8ea08178a7ec510e8f286e4d..394494c0ce6c0f0a99950f1a12c32dcaa6e6ef0c 100644 (file)
@@ -14,10 +14,10 @@ import {
 } from 'sequelize-typescript'
 import { TokensCache } from '@server/lib/auth/tokens-cache'
 import { MNotificationSettingFormattable } from '@server/types/models'
-import { AttributesOnly } from '@shared/core-utils'
+import { AttributesOnly } from '@shared/typescript-utils'
 import { UserNotificationSetting, UserNotificationSettingValue } from '../../../shared/models/users/user-notification-setting.model'
 import { isUserNotificationSettingValid } from '../../helpers/custom-validators/user-notifications'
-import { throwIfNotValid } from '../utils'
+import { throwIfNotValid } from '../shared'
 import { UserModel } from './user'
 
 @Table({
@@ -175,6 +175,15 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<U
   @Column
   newPluginVersion: UserNotificationSettingValue
 
+  @AllowNull(false)
+  @Default(null)
+  @Is(
+    'UserNotificationSettingMyVideoStudioEditionFinished',
+    value => throwIfNotValid(value, isUserNotificationSettingValid, 'myVideoStudioEditionFinished')
+  )
+  @Column
+  myVideoStudioEditionFinished: UserNotificationSettingValue
+
   @ForeignKey(() => UserModel)
   @Column
   userId: number
@@ -216,6 +225,7 @@ export class UserNotificationSettingModel extends Model<Partial<AttributesOnly<U
       abuseNewMessage: this.abuseNewMessage,
       abuseStateChange: this.abuseStateChange,
       newPeerTubeVersion: this.newPeerTubeVersion,
+      myVideoStudioEditionFinished: this.myVideoStudioEditionFinished,
       newPluginVersion: this.newPluginVersion
     }
   }