]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/models/account/user.ts
move to boolean switch
[github/Chocobozzz/PeerTube.git] / server / models / account / user.ts
index 39654cfcf2f51326f71dc538913aa911942fdb44..4b4a562fa96f69ba59ceaa33b03e482975bba407 100644 (file)
@@ -31,7 +31,8 @@ import {
   isUserRoleValid,
   isUserUsernameValid,
   isUserVideoQuotaDailyValid,
-  isUserVideoQuotaValid
+  isUserVideoQuotaValid,
+  isUserWebTorrentEnabledValid
 } from '../../helpers/custom-validators/users'
 import { comparePassword, cryptPassword } from '../../helpers/peertube-crypto'
 import { OAuthTokenModel } from '../oauth/oauth-token'
@@ -107,6 +108,11 @@ export class UserModel extends Model<UserModel> {
   @Column(DataType.ENUM(values(NSFW_POLICY_TYPES)))
   nsfwPolicy: NSFWPolicyType
 
+  @AllowNull(false)
+  @Is('UserWebTorrentEnabled', value => throwIfNotValid(value, isUserWebTorrentEnabledValid, 'WebTorrent enabled'))
+  @Column
+  webTorrentEnabled: boolean
+
   @AllowNull(false)
   @Default(true)
   @Is('UserAutoPlayVideo', value => throwIfNotValid(value, isUserAutoPlayVideoValid, 'auto play video boolean'))
@@ -355,6 +361,7 @@ export class UserModel extends Model<UserModel> {
       email: this.email,
       emailVerified: this.emailVerified,
       nsfwPolicy: this.nsfwPolicy,
+      webTorrentEnabled: this.webTorrentEnabled,
       autoPlayVideo: this.autoPlayVideo,
       role: this.role,
       roleLabel: USER_ROLE_LABELS[ this.role ],