diff --git a/service/.gitignore b/service/.gitignore index 3e17af018..e1fda51c3 100644 --- a/service/.gitignore +++ b/service/.gitignore @@ -1,3 +1,4 @@ /lib/ /test-lib/ /functionalTests-lib/ +.angular-cache/ diff --git a/service/src/app.impl/users/app.impl.users.ts b/service/src/app.impl/users/app.impl.users.ts index c98b4c8f3..8c8b15b9c 100644 --- a/service/src/app.impl/users/app.impl.users.ts +++ b/service/src/app.impl/users/app.impl.users.ts @@ -3,19 +3,9 @@ import { UserRepository } from '../../entities/users/entities.users'; import { withPermission, KnownErrorsOf } from '../../app.api/app.api.global'; import { PageOf } from '../../entities/entities.global'; -export function SearchUsers( - userRepo: UserRepository, - permissions: api.UsersPermissionService +export function SearchUsers(userRepo: UserRepository,permissions: api.UsersPermissionService ): api.SearchUsers { - return async function searchUsers( - req: api.UserSearchRequest - ): ReturnType { - // Use the buildFilter function to construct the filter - const userSearch: api.UserSearchRequest['userSearch'] = buildFilter( - req.userSearch - ); - - // Continue with the rest of the logic, including the search operation + return async function searchUsers(req: api.UserSearchRequest): ReturnType { return await withPermission< PageOf, KnownErrorsOf @@ -23,7 +13,7 @@ export function SearchUsers( permissions.ensureReadUsersPermission(req.context), async (): Promise> => { const page = await userRepo.find( - userSearch, + req.userSearch, x => { return { id: x.id, @@ -44,16 +34,4 @@ export function SearchUsers( } ); }; -} - -// Function to abstract parameter handling and filter building -function buildFilter(userSearch: api.UserSearchRequest['userSearch']): api.UserSearchRequest['userSearch'] { - const filter: api.UserSearchRequest['userSearch'] = { - nameOrContactTerm: userSearch.nameOrContactTerm, - pageSize: userSearch.pageSize || 250, - pageIndex: userSearch.pageIndex || 0, - includeTotalCount: userSearch.includeTotalCount, - }; - - return filter; -} +} \ No newline at end of file