diff options
Diffstat (limited to 'server/models/account')
-rw-r--r-- | server/models/account/user.ts | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/server/models/account/user.ts b/server/models/account/user.ts index 3bde1e744..de193131a 100644 --- a/server/models/account/user.ts +++ b/server/models/account/user.ts | |||
@@ -412,11 +412,18 @@ export class UserModel extends Model<UserModel> { | |||
412 | return this.count() | 412 | return this.count() |
413 | } | 413 | } |
414 | 414 | ||
415 | static listForApi (start: number, count: number, sort: string, search?: string) { | 415 | static listForApi (parameters: { |
416 | let where: WhereOptions | 416 | start: number |
417 | count: number | ||
418 | sort: string | ||
419 | search?: string | ||
420 | blocked?: boolean | ||
421 | }) { | ||
422 | const { start, count, sort, search, blocked } = parameters | ||
423 | const where: WhereOptions = {} | ||
417 | 424 | ||
418 | if (search) { | 425 | if (search) { |
419 | where = { | 426 | Object.assign(where, { |
420 | [Op.or]: [ | 427 | [Op.or]: [ |
421 | { | 428 | { |
422 | email: { | 429 | email: { |
@@ -429,7 +436,13 @@ export class UserModel extends Model<UserModel> { | |||
429 | } | 436 | } |
430 | } | 437 | } |
431 | ] | 438 | ] |
432 | } | 439 | }) |
440 | } | ||
441 | |||
442 | if (blocked !== undefined) { | ||
443 | Object.assign(where, { | ||
444 | blocked: blocked | ||
445 | }) | ||
433 | } | 446 | } |
434 | 447 | ||
435 | const query: FindOptions = { | 448 | const query: FindOptions = { |