diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2022-06-30 15:32:11 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2022-06-30 15:32:11 +0900 |
| commit | 6f3e64f13e146ba3bf9b97f0444c7518d98195ab (patch) | |
| tree | 70c3b6c784243fa9033aa0f87a55db0067377913 /packages/backend/src/server/api/endpoints | |
| parent | enhance(client): show confirm dialog when logout (diff) | |
| download | sharkey-6f3e64f13e146ba3bf9b97f0444c7518d98195ab.tar.gz sharkey-6f3e64f13e146ba3bf9b97f0444c7518d98195ab.tar.bz2 sharkey-6f3e64f13e146ba3bf9b97f0444c7518d98195ab.zip | |
chore(client): tweak client
Diffstat (limited to 'packages/backend/src/server/api/endpoints')
| -rw-r--r-- | packages/backend/src/server/api/endpoints/users.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/packages/backend/src/server/api/endpoints/users.ts b/packages/backend/src/server/api/endpoints/users.ts index 2377faebd3..3a8211374b 100644 --- a/packages/backend/src/server/api/endpoints/users.ts +++ b/packages/backend/src/server/api/endpoints/users.ts @@ -27,6 +27,12 @@ export const paramDef = { sort: { type: 'string', enum: ['+follower', '-follower', '+createdAt', '-createdAt', '+updatedAt', '-updatedAt'] }, state: { type: 'string', enum: ['all', 'admin', 'moderator', 'adminOrModerator', 'alive'], default: 'all' }, origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: 'local' }, + hostname: { + type: 'string', + nullable: true, + default: null, + description: 'The local host is represented with `null`.', + }, }, required: [], } as const; @@ -48,6 +54,10 @@ export default define(meta, paramDef, async (ps, me) => { case 'remote': query.andWhere('user.host IS NOT NULL'); break; } + if (ps.hostname) { + query.andWhere('user.host = :hostname', { hostname: ps.hostname.toLowerCase() }); + } + switch (ps.sort) { case '+follower': query.orderBy('user.followersCount', 'DESC'); break; case '-follower': query.orderBy('user.followersCount', 'ASC'); break; |