Skip to content

Commit

Permalink
Migrate subtask functionality in server (#69)
Browse files Browse the repository at this point in the history
Co-authored-by: Julian Rupprecht <[email protected]>
  • Loading branch information
maximilianruesch and JulianRupprecht authored Nov 21, 2023
1 parent e06f3c3 commit 58ada74
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion electron/providers/base-provider/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export interface IProvider {
createIssue(issue: Issue): Promise<string>
createSubtask(
parentIssueKey: string,
projectId: string,
subtaskSummary: string,
projectId: string,
subtaskIssueTypeId: string
): Promise<{ id: string; key: string }>
getEpicsByProject(projectIdOrKey: string): Promise<Issue[]>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1022,8 +1022,8 @@ export class JiraCloudProvider implements IProvider {

createSubtask(
parentIssueKey: string,
projectId: string,
subtaskSummary: string,
projectId: string,
subtaskIssueTypeId: string
): Promise<{ id: string; key: string }> {
return new Promise((resolve, reject) => {
Expand Down
30 changes: 28 additions & 2 deletions electron/providers/jira-server-provider/JiraServerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,11 +517,37 @@ export class JiraServerProvider implements IProvider {

createSubtask(
parentIssueKey: string,
projectId: string,
subtaskSummary: string,
projectId: string,
subtaskIssueTypeId: string
): Promise<{ id: string; key: string }> {
throw new Error("Method not implemented for Jira Server")
return new Promise((resolve, reject) => {
this.getRestApiClient(2)
.post(
'/issue',
{
fields: {
summary: subtaskSummary,
issuetype: {
id: subtaskIssueTypeId,
},
parent: {
key: parentIssueKey,
},
project: {
id: projectId,
},
},
}
)
.then(async (response) => {
const createdSubtask: { id: string; key: string } = response.data
resolve(createdSubtask)
})
.catch((error) => {
reject(new Error(`Error creating subtask: ${error}`))
})
})
}

editIssue(
Expand Down

0 comments on commit 58ada74

Please sign in to comment.