mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
fix(core): fix findUsersByIds for empty ids case (#2892)
This commit is contained in:
parent
f7c08332a1
commit
8b8103132e
1 changed files with 7 additions and 5 deletions
|
@ -161,11 +161,13 @@ export const createUserQueries = (pool: CommonQueryMethods) => {
|
|||
);
|
||||
|
||||
const findUsersByIds = async (userIds: string[]) =>
|
||||
pool.any<User>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`, `)}
|
||||
from ${table}
|
||||
where ${fields.id} in (${sql.join(userIds, sql`, `)})
|
||||
`);
|
||||
userIds.length > 0
|
||||
? pool.any<User>(sql`
|
||||
select ${sql.join(Object.values(fields), sql`, `)}
|
||||
from ${table}
|
||||
where ${fields.id} in (${sql.join(userIds, sql`, `)})
|
||||
`)
|
||||
: [];
|
||||
|
||||
const updateUser = buildUpdateWhereWithPool(pool)<CreateUser, User>(Users, true);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue