aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/account/user.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/account/user.ts')
-rw-r--r--server/models/account/user.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts
index 89265774b..4b13e47a0 100644
--- a/server/models/account/user.ts
+++ b/server/models/account/user.ts
@@ -39,6 +39,7 @@ import { AccountModel } from './account'
39import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type' 39import { NSFWPolicyType } from '../../../shared/models/videos/nsfw-policy.type'
40import { values } from 'lodash' 40import { values } from 'lodash'
41import { NSFW_POLICY_TYPES } from '../../initializers' 41import { NSFW_POLICY_TYPES } from '../../initializers'
42import { VideoFileModel } from '../video/video-file'
42 43
43enum ScopeNames { 44enum ScopeNames {
44 WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL' 45 WITH_VIDEO_CHANNEL = 'WITH_VIDEO_CHANNEL'
@@ -393,4 +394,15 @@ export class UserModel extends Model<UserModel> {
393 return parseInt(total, 10) 394 return parseInt(total, 10)
394 }) 395 })
395 } 396 }
397
398 static autocomplete (search: string) {
399 return UserModel.findAll({
400 where: {
401 username: {
402 [Sequelize.Op.like]: `%${search}%`
403 }
404 }
405 })
406 .then(u => u.map(u => u.username))
407 }
396} 408}