Skip to content

Commit

Permalink
feat: add support to filter by assignee
Browse files Browse the repository at this point in the history
  • Loading branch information
jamacku committed Aug 12, 2024
1 parent 1d43cfe commit 5d83206
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/jira.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@ export class Jira {
return response.issues ?? raise('Jira.getIssuesByID(): missing issues.');
}

async getIssues(component: string) {
async getIssues(component: string, assignee?: string) {
const dynamicQuery = assignee
? `component = ${component} AND assignee = "${assignee}"`
: `component = ${component}`;

Check warning on line 53 in src/jira.ts

View check run for this annotation

Codecov / codecov/patch

src/jira.ts#L50-L53

Added lines #L50 - L53 were not covered by tests

const response = await this.api.issueSearch.searchForIssuesUsingJqlPost({
jql: `${this.baseJQL} AND component = ${component} ORDER BY id DESC`,
jql: `${this.baseJQL} AND ${dynamicQuery} ORDER BY id DESC`,

Check warning on line 56 in src/jira.ts

View check run for this annotation

Codecov / codecov/patch

src/jira.ts#L56

Added line #L56 was not covered by tests
fields: [
'id',
'issuetype',
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const cli = async () => {
const issues =
args.length > 0
? await jira.getIssuesByID(args)
: await jira.getIssues(options.component);
: await jira.getIssues(options.component, options.assignee);

Check warning on line 64 in src/main.ts

View check run for this annotation

Codecov / codecov/patch

src/main.ts#L64

Added line #L64 was not covered by tests

const numberOfIssues = issues.length;

Expand Down

0 comments on commit 5d83206

Please sign in to comment.