mirror of
https://github.com/fallenbagel/jellyseerr.git
synced 2026-01-01 12:18:35 -05:00
fix(users): correct user list for Postgres (#1443)
PostgreSQL requires that the ORDER BY expression must appear in the SELECT list when using DISTINCT. Since we were using a computed expression in the ORDER BY clause, we need to include it in the SELECT list as well. re #1333
This commit is contained in:
@@ -60,22 +60,24 @@ router.get('/', async (req, res, next) => {
|
|||||||
query = query.orderBy('user.updatedAt', 'DESC');
|
query = query.orderBy('user.updatedAt', 'DESC');
|
||||||
break;
|
break;
|
||||||
case 'displayname':
|
case 'displayname':
|
||||||
query = query.orderBy(
|
query = query
|
||||||
`CASE WHEN (user.username IS NULL OR user.username = '') THEN (
|
.addSelect(
|
||||||
CASE WHEN (user.plexUsername IS NULL OR user.plexUsername = '') THEN (
|
`CASE WHEN (user.username IS NULL OR user.username = '') THEN (
|
||||||
CASE WHEN (user.jellyfinUsername IS NULL OR user.jellyfinUsername = '') THEN
|
CASE WHEN (user.plexUsername IS NULL OR user.plexUsername = '') THEN (
|
||||||
"user"."email"
|
CASE WHEN (user.jellyfinUsername IS NULL OR user.jellyfinUsername = '') THEN
|
||||||
ELSE
|
"user"."email"
|
||||||
LOWER(user.jellyfinUsername)
|
ELSE
|
||||||
END)
|
LOWER(user.jellyfinUsername)
|
||||||
ELSE
|
END)
|
||||||
LOWER(user.jellyfinUsername)
|
ELSE
|
||||||
END)
|
LOWER(user.jellyfinUsername)
|
||||||
ELSE
|
END)
|
||||||
LOWER(user.username)
|
ELSE
|
||||||
END`,
|
LOWER(user.username)
|
||||||
'ASC'
|
END`,
|
||||||
);
|
'displayname_sort_key'
|
||||||
|
)
|
||||||
|
.orderBy('displayname_sort_key', 'ASC');
|
||||||
break;
|
break;
|
||||||
case 'requests':
|
case 'requests':
|
||||||
query = query
|
query = query
|
||||||
|
|||||||
Reference in New Issue
Block a user