Skip to content

Commit

Permalink
fixing linear create issue func
Browse files Browse the repository at this point in the history
  • Loading branch information
ganimtron-10 committed Aug 14, 2024
1 parent acea3dc commit e7d95d3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
16 changes: 15 additions & 1 deletion packages/api/src/ticketing/@lib/@utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as fs from 'fs';

@Injectable()
export class Utils {
constructor(private readonly prisma: PrismaService) {}
constructor(private readonly prisma: PrismaService) { }

async fetchFileStreamFromURL(file_url: string) {
return fs.createReadStream(file_url);
Expand All @@ -27,6 +27,20 @@ export class Utils {
}
}

async getTeamRemoteIdFromUuid(uuid: string) {
try {
const res = await this.prisma.tcg_teams.findFirst({
where: {
id_tcg_team: uuid,
},
});
if (!res) return undefined;
return res.remote_id;
} catch (error) {
throw error;
}
}

async getRemoteIdFromTagName(name: string, connection_id: string) {
try {
const res = await this.prisma.tcg_tags.findFirst({
Expand Down
10 changes: 5 additions & 5 deletions packages/api/src/ticketing/ticket/services/linear/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ export class LinearService implements ITicketService {
"issueCreateInput": {
"title": ticketData.title,
"description": ticketData.description,
"assigneeId": ticketData.assignee.id,
"parentId": ticketData.parent.id,
"labelIds": ticketData.labels.nodes,
"projectId": ticketData.project.id,
"sourceCommentId": ticketData.comments.nodes,
"assigneeId": ticketData.assignee?.id,
"parentId": ticketData.parent?.id,
"labelIds": ticketData.labels?.nodes,
"projectId": ticketData.project?.id,
"sourceCommentId": ticketData.comments?.nodes,
"dueDate": ticketData.dueDate,
"teamId": ticketData.team.id
}
Expand Down
3 changes: 2 additions & 1 deletion packages/api/src/ticketing/ticket/services/linear/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export class LinearTicketMapper implements ITicketMapper {
title: source.name,
description: source.description ? source.description : null,
// Passing new Field to retreive repositroy info to add ticket to that repo
project: source.collections[0] as string
project: source.collections ? source.collections[0] as string : null,
team: { id: await this.utils.getTeamRemoteIdFromUuid(source.field_mappings["team_id"]) },
};


Expand Down

0 comments on commit e7d95d3

Please sign in to comment.