diff options
Diffstat (limited to 'server/models')
-rw-r--r-- | server/models/account/user.ts | 8 |
1 files changed, 6 insertions, 2 deletions
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' | |||
36 | import { values } from 'lodash' | 36 | import { values } from 'lodash' |
37 | import { NSFW_POLICY_TYPES } from '../../initializers' | 37 | import { NSFW_POLICY_TYPES } from '../../initializers' |
38 | 38 | ||
39 | enum ScopeNames { | ||
40 | WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' | ||
41 | } | ||
42 | |||
39 | @DefaultScope({ | 43 | @DefaultScope({ |
40 | include: [ | 44 | include: [ |
41 | { | 45 | { |
@@ -45,7 +49,7 @@ import { NSFW_POLICY_TYPES } from '../../initializers' | |||
45 | ] | 49 | ] |
46 | }) | 50 | }) |
47 | @Scopes({ | 51 | @Scopes({ |
48 | withVideoChannel: { | 52 | [ScopeNames.WITH_VIDEO_CHANNEL]: { |
49 | include: [ | 53 | include: [ |
50 | { | 54 | { |
51 | model: () => AccountModel, | 55 | model: () => AccountModel, |
@@ -199,7 +203,7 @@ export class UserModel extends Model<UserModel> { | |||
199 | } | 203 | } |
200 | } | 204 | } |
201 | 205 | ||
202 | return UserModel.scope('withVideoChannel').findOne(query) | 206 | return UserModel.scope(ScopeNames.WITH_VIDEO_CHANNEL).findOne(query) |
203 | } | 207 | } |
204 | 208 | ||
205 | static loadByEmail (email: string) { | 209 | static loadByEmail (email: string) { |