Skip to content

Commit

Permalink
Temp: merge with parkedParentSource commit
Browse files Browse the repository at this point in the history
  • Loading branch information
manelcecs committed Dec 26, 2023
1 parent d813008 commit ff8d11f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/domain-services/flows/flow-search-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,14 @@ export class FlowSearchService {
databaseConnection: Knex,
filters: SearchFlowsArgs
): Promise<FlowSearchResult> {
const { limit, nextPageCursor, prevPageCursor, sortField, sortOrder } =
filters;
const {
limit,
nextPageCursor,
prevPageCursor,
sortField,
sortOrder,
includeChildrenOfParkedFlows: shouldIncludeChildrenOfParkedFlows,
} = filters;

const orderBy: FlowOrderBy = this.buildOrderBy(sortField, sortOrder);

Expand Down Expand Up @@ -499,7 +505,8 @@ export class FlowSearchService {

let parkedParentSource: FlowParkedParentSource | null = null;
const shouldLookAfterParentSource =
flow.activeStatus && flowLink.length > 0;
flowLink.length > 0 && shouldIncludeChildrenOfParkedFlows;

if (shouldLookAfterParentSource) {
parkedParentSource = await this.getParketParents(
flow,
Expand Down Expand Up @@ -848,6 +855,7 @@ export class FlowSearchService {
const mappedParkedParentOrganizations: FlowParkedParentSource = {
organization: [],
orgName: [],
abbreviation: [],
};

for (const parkedParentOrganization of parkedParentOrganizations) {
Expand All @@ -857,6 +865,9 @@ export class FlowSearchService {
mappedParkedParentOrganizations.orgName.push(
parkedParentOrganization.name
);
mappedParkedParentOrganizations.abbreviation.push(
parkedParentOrganization.abbreviation ?? ''
);
}

return mappedParkedParentOrganizations;
Expand Down
3 changes: 3 additions & 0 deletions src/domain-services/flows/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export class FlowParkedParentSource {

@Field(() => [String], { nullable: false })
orgName: string[];

@Field(() => [String], { nullable: false })
abbreviation: string[];
}

@ObjectType()
Expand Down

0 comments on commit ff8d11f

Please sign in to comment.