X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmodels%2Faccount%2Fuser.ts;h=1165285ea318195200f818f4cf58af0b571eeb4a;hb=9c2e0dbfa9098675390e00ccb0fa49c51b3c6732;hp=56af2f30a979605248dfa3d8de08dce2cb328ae7;hpb=0883b3245bf0deb9106c4041e9afbd3521b79280;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 56af2f30a..1165285ea 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts @@ -36,6 +36,10 @@ import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' import { values } from 'lodash' import { NSFW_POLICY_TYPES } from '../../initializers' +enum ScopeNames { + WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' +} + @DefaultScope({ include: [ { @@ -45,7 +49,7 @@ import { NSFW_POLICY_TYPES } from '../../initializers' ] }) @Scopes({ - withVideoChannel: { + [ScopeNames.WITH_VIDEO_CHANNEL]: { include: [ { model: () => AccountModel, @@ -199,7 +203,7 @@ export class UserModel extends Model { } } - return UserModel.scope('withVideoChannel').findOne(query) + return UserModel.scope(ScopeNames.WITH_VIDEO_CHANNEL).findOne(query) } static loadByEmail (email: string) {