Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
IR-3700: Added search by sso/email in user table (#10929)
Browse files Browse the repository at this point in the history
* chore: Update search functionality in UserTable component

* Added persistQuery in hook

* Optimized query

---------

Co-authored-by: Hanzla Mateen <[email protected]>
  • Loading branch information
MoizAdnan and hanzlamateen authored Aug 13, 2024
1 parent 5755786 commit d89646f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
13 changes: 1 addition & 12 deletions packages/client-core/src/admin/components/user/UserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,7 @@ export default function UserTable({
useSearch(
adminUserQuery,
{
$or: [
{
id: {
$like: `%${search}%`
}
},
{
name: {
$like: `%${search}%`
}
}
]
search
},
search
)
Expand Down
3 changes: 3 additions & 0 deletions packages/common/src/schemas/user/identity-provider.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ export const identityProviderQuerySchema = Type.Intersect(
querySyntax(identityProviderQueryProperties, {
accountIdentifier: {
$like: Type.String()
},
email: {
$like: Type.String()
}
}),
// Add additional query properties here
Expand Down
16 changes: 13 additions & 3 deletions packages/server-core/src/user/user/user.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,19 @@ const handleUserSearch = async (context: HookContext<UserService>) => {

const searchedIdentityProviders = (await context.app.service(identityProviderPath).find({
query: {
accountIdentifier: {
$like: `%${search}%`
}
$select: ['id', 'userId'],
$or: [
{
accountIdentifier: {
$like: `%${search}%`
}
},
{
email: {
$like: `%${search}%`
}
}
]
},
paginate: false
})) as IdentityProviderType[]
Expand Down

0 comments on commit d89646f

Please sign in to comment.