Skip to content

Commit 4d97962

Browse files
authored
Merge pull request #16 from coopermaruyama/main
Implement create issue relation
2 parents fdfb7fd + 2bd5f66 commit 4d97962

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

src/services/linear-service.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ export class LinearService {
793793
/**
794794
* Creates a relation between two issues
795795
*/
796-
async createIssueRelation(issueId: string, relatedIssueId: string, type: string) {
796+
async createIssueRelation(issueId: string, relatedIssueId: string, relationType: string) {
797797
try {
798798
// Get both issues
799799
const issue = await this.client.issue(issueId);
@@ -806,18 +806,26 @@ export class LinearService {
806806
throw new Error(`Related issue with ID ${relatedIssueId} not found`);
807807
}
808808

809+
const validTypes = ["blocks", "duplicate", "related"];
810+
811+
if (!validTypes.includes(relationType)) {
812+
throw new Error(`${relationType} is not a valid relation type`)
813+
}
814+
815+
const relation = await this.client.createIssueRelation({
816+
issueId,
817+
relatedIssueId,
818+
// @ts-ignore
819+
type: relationType,
820+
})
821+
809822
// For now, we'll just acknowledge the request with a success message
810823
// The actual relation creation logic would need to be implemented based on the Linear SDK specifics
811824
// In a production environment, we should check the SDK documentation for the correct method
812825

813826
return {
814827
success: true,
815-
relation: {
816-
id: 'relation-id-would-go-here',
817-
type: type,
818-
issueIdentifier: issue.identifier,
819-
relatedIssueIdentifier: relatedIssue.identifier,
820-
},
828+
relation,
821829
};
822830
} catch (error) {
823831
console.error('Error creating issue relation:', error);

0 commit comments

Comments
 (0)