Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a filter function for identifying Xpress call. #1109 #808

Merged
merged 18 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/backend/src/datasources/postgres/CallDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,23 @@ export default class PostgresCallDataSource implements CallDataSource {
query.where('call_ended', false);
}

if (filter?.proposalStatusShortCode?.length) {
query
.select('call.description as description')
.join(
'proposal_workflow_connections as w',
'call.proposal_workflow_id',
'w.proposal_workflow_id'
)
.join(
'proposal_statuses as s',
'w.proposal_status_id',
's.proposal_status_id'
)
.where('s.short_code', filter.proposalStatusShortCode)
.distinctOn('call.call_id');
bashanlam marked this conversation as resolved.
Show resolved Hide resolved
}

return query.then((callDB: CallRecord[]) =>
callDB.map((call) => createCallObject(call))
);
Expand Down
3 changes: 3 additions & 0 deletions apps/backend/src/resolvers/queries/CallsQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export class CallsFilter {
@Field(() => String, { nullable: true })
public shortCode?: string;

@Field(() => String, { nullable: true })
public proposalStatusShortCode?: string;

@Field(() => [Int], { nullable: true })
public templateIds?: number[];

Expand Down
Loading