Skip to content

Commit

Permalink
fix: include sub project in projects search (#3147)
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha authored Jul 15, 2024
1 parent e9a8508 commit 1a6fa05
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export const ProjectPlatformParams: PlatformProjectParams = deepFreeze({
limit: 10,
offset: 0,
is_enabled: 'eq.true',
or: '(category_ids.is.null, category_ids.ov.{122269,122270,122271,122272,122273})',
or: '(category_ids.is.null, category_ids.ov.{122269,122270,122271,122272,122273},name.ilike."%search%",sub_project.ilike."%search%")',
id: 'in.(3943,305792,148971,247936)',
name: 'ilike.%search%',
});
9 changes: 5 additions & 4 deletions src/app/core/services/projects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class ProjectsService {
// `orgCategoryIds` can be optional
this.addOrgCategoryIdsFilter(orgCategoryIds, params);

// `projectIds` can be optional
this.addProjectIdsFilter(projectIds, params);

// `searchNameText` can be optional
this.addNameSearchFilter(searchNameText, params);

// `projectIds` can be optional
this.addProjectIdsFilter(projectIds, params);

return this.spenderPlatformV1ApiService
.get<PlatformApiResponse<PlatformProject[]>>('/projects', {
params,
Expand Down Expand Up @@ -83,7 +83,8 @@ export class ProjectsService {

addNameSearchFilter(searchNameText: string, params: PlatformProjectParams): void {
if (typeof searchNameText !== 'undefined' && searchNameText !== null) {
params.name = 'ilike.%' + searchNameText + '%';
params.or = params.or ? `${params.or.slice(0, -1)},` : '(';
params.or += `name.ilike."%${searchNameText}%",sub_project.ilike."%${searchNameText}%")`;
}
}

Expand Down

0 comments on commit 1a6fa05

Please sign in to comment.