From 8dac3350b85e5c11ea3b836a59e2a8bd250c90d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20R=C3=BCsch?= Date: Mon, 18 Dec 2023 18:49:02 +0100 Subject: [PATCH] Reconstruct server and cloud implementations --- .../jira-cloud-provider/JiraCloudProvider.ts | 15 +++++++++--- .../JiraServerProvider.ts | 23 ++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/electron/providers/jira-cloud-provider/JiraCloudProvider.ts b/electron/providers/jira-cloud-provider/JiraCloudProvider.ts index e837ec4a..471ab806 100644 --- a/electron/providers/jira-cloud-provider/JiraCloudProvider.ts +++ b/electron/providers/jira-cloud-provider/JiraCloudProvider.ts @@ -12,6 +12,7 @@ import { User, } from "../../../types" import { + JiraEpic, JiraIssue, JiraIssueType, JiraPriority, @@ -847,10 +848,10 @@ export class JiraCloudProvider implements IProvider { async getEpicsByProject(projectIdOrKey: string): Promise { 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 = 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, @@ -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, diff --git a/electron/providers/jira-server-provider/JiraServerProvider.ts b/electron/providers/jira-server-provider/JiraServerProvider.ts index 402c4668..97c15dfc 100644 --- a/electron/providers/jira-server-provider/JiraServerProvider.ts +++ b/electron/providers/jira-server-provider/JiraServerProvider.ts @@ -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"; @@ -576,10 +576,10 @@ export class JiraServerProvider implements IProvider { getEpicsByProject(projectIdOrKey: string): Promise { 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 = 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, @@ -587,6 +587,23 @@ export class JiraServerProvider implements IProvider { 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)