Skip to content

Commit

Permalink
Reconstruct server and cloud implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianruesch committed Dec 18, 2023
1 parent 4ecdd3b commit 8dac335
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
15 changes: 12 additions & 3 deletions electron/providers/jira-cloud-provider/JiraCloudProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
User,
} from "../../../types"
import {
JiraEpic,
JiraIssue,
JiraIssueType,
JiraPriority,
Expand Down Expand Up @@ -847,10 +848,10 @@ export class JiraCloudProvider implements IProvider {
async getEpicsByProject(projectIdOrKey: string): Promise<Issue[]> {
return new Promise((resolve, reject) => {
this.getRestApiClient(3)
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}`)
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}&fields=*all`)
.then(async (response) => {
const epics: Promise<Issue[]> = Promise.all(
response.data.issues.map(async (element: JiraIssue) => ({
response.data.issues.map(async (element: JiraEpic) => ({
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
Expand All @@ -861,7 +862,15 @@ export class JiraCloudProvider implements IProvider {
subtasks: element.fields.subtasks,
created: element.fields.created,
updated: element.fields.updated,
comment: element.fields.comment ?? {
comment: {
comments: element.fields.comment.comments.map((commentElement) => ({
id: commentElement.id,
body: commentElement.body.content[0].content[0].text,
author: commentElement.author,
created: commentElement.created,
updated: commentElement.updated,
})),
} ?? {
comments: [],
},
projectId: element.fields.project.id,
Expand Down
23 changes: 20 additions & 3 deletions electron/providers/jira-server-provider/JiraServerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
SprintCreate,
User,
} from "../../../types"
import {JiraIssue, JiraIssueType, JiraProject, JiraSprint,} from "../../../types/jira"
import {JiraEpic, JiraIssue, JiraIssueType, JiraProject, JiraSprint,} from "../../../types/jira"
import {IProvider} from "../base-provider"
import {JiraServerInfo, JiraServerUser} from "./server-types";

Expand Down Expand Up @@ -576,17 +576,34 @@ export class JiraServerProvider implements IProvider {
getEpicsByProject(projectIdOrKey: string): Promise<Issue[]> {
return new Promise((resolve, reject) => {
this.getRestApiClient(2)
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}`)
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}&fields=*all`)
.then(async (response) => {
const epics: Promise<Issue[]> = Promise.all(
response.data.issues.map(async (element: JiraIssue) => ({
response.data.issues.map(async (element: JiraEpic) => ({
issueKey: element.key,
summary: element.fields.summary,
labels: element.fields.labels,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
subtasks: element.fields.subtasks,
created: element.fields.created,
updated: element.fields.updated,
comment: {
comments: element.fields.comment.comments.map((commentElement) => ({
id: commentElement.id,
body: commentElement.body,
author: commentElement.author,
created: commentElement.created,
updated: commentElement.updated,
})),
} ?? {
comments: [],
},
projectId: element.fields.project.id,
sprint: element.fields.sprint,
attachments: element.fields.attachment,
}))
)
resolve(epics)
Expand Down

0 comments on commit 8dac335

Please sign in to comment.