-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Github Connector #568
Add Github Connector #568
Changes from all commits
ef976f7
c41d76f
cb092b7
420a7f9
cc800d8
f010d54
b54b3a5
539856c
76f53e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
INSERT INTO users (id_user, identification_strategy, email, password_hash, first_name, last_name) VALUES | ||
('0ce39030-2901-4c56-8db0-5e326182ec6b', 'b2c','[email protected]', '$2b$10$Y7Q8TWGyGuc5ecdIASbBsuXMo3q/Rs3/cnY.mLZP4tUgfGUOCUBlG', 'local', 'Panora'); | ||
|
||
INSERT INTO connector_sets (id_connector_set, crm_hubspot, crm_zoho, crm_pipedrive, crm_attio, crm_zendesk, crm_close, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab, fs_box) VALUES | ||
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('852dfff8-ab63-4530-ae49-e4b2924407f8', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('aed0f856-f802-4a79-8640-66d441581a99', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); | ||
INSERT INTO connector_sets (id_connector_set, crm_hubspot, crm_zoho, crm_pipedrive, crm_attio, crm_zendesk, crm_close, tcg_zendesk, tcg_gorgias, tcg_front, tcg_jira, tcg_gitlab, fs_box, tcg_github) VALUES | ||
('1709da40-17f7-4d3a-93a0-96dc5da6ddd7', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('852dfff8-ab63-4530-ae49-e4b2924407f8', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE), | ||
('aed0f856-f802-4a79-8640-66d441581a99', TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE); | ||
|
||
INSERT INTO projects (id_project, name, sync_mode, id_user, id_connector_set) VALUES | ||
('1e468c15-aa57-4448-aa2b-7fed640d1e3d', 'Project 1', 'pull', '0ce39030-2901-4c56-8db0-5e326182ec6b', '1709da40-17f7-4d3a-93a0-96dc5da6ddd7'), | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,3 +1,16 @@ | ||||||||||||
import { GithubCollectionInput, GithubCollectionOutput } from '@ticketing/collection/services/github/types'; | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ensure consistent import style. The import statement for GitHub types should be consistent with other import statements. - import { GithubCollectionInput, GithubCollectionOutput } from '@ticketing/collection/services/github/types';
+ import {
+ GithubCollectionInput,
+ GithubCollectionOutput,
+ } from '@ticketing/collection/services/github/types'; Committable suggestion
Suggested change
|
||||||||||||
|
||||||||||||
import { GithubCommentInput, GithubCommentOutput } from '@ticketing/comment/services/github/types'; | ||||||||||||
|
||||||||||||
import { GithubTagInput, GithubTagOutput } from '@ticketing/tag/services/github/types'; | ||||||||||||
|
||||||||||||
import { GithubTeamInput, GithubTeamOutput } from '@ticketing/team/services/github/types'; | ||||||||||||
|
||||||||||||
import { GithubTicketInput, GithubTicketOutput } from '@ticketing/ticket/services/github/types'; | ||||||||||||
|
||||||||||||
import { GithubUserInput, GithubUserOutput } from '@ticketing/user/services/github/types'; | ||||||||||||
import { GitlabUserInput, GitlabUserOutput } from '@ticketing/user/services/gitlab/types'; | ||||||||||||
|
||||||||||||
import { | ||||||||||||
FrontAccountInput, | ||||||||||||
FrontAccountOutput, | ||||||||||||
|
@@ -131,7 +144,7 @@ export type OriginalTicketInput = | |||||||||||
| FrontTicketInput | ||||||||||||
| GorgiasTicketInput | ||||||||||||
| JiraTicketInput | ||||||||||||
| GitlabTicketInput; | ||||||||||||
| GitlabTicketInput | GithubTicketInput; | ||||||||||||
//| JiraServiceMgmtTicketInput; | ||||||||||||
|
||||||||||||
/* comment */ | ||||||||||||
|
@@ -140,14 +153,14 @@ export type OriginalCommentInput = | |||||||||||
| FrontCommentInput | ||||||||||||
| GorgiasCommentInput | ||||||||||||
| JiraCommentInput | ||||||||||||
| GitlabCommentInput; | ||||||||||||
| GitlabCommentInput | GithubCommentInput; | ||||||||||||
//| JiraCommentServiceMgmtInput; | ||||||||||||
/* user */ | ||||||||||||
export type OriginalUserInput = | ||||||||||||
| ZendeskUserInput | ||||||||||||
| FrontUserInput | ||||||||||||
| GorgiasUserInput | ||||||||||||
| JiraUserInput; | ||||||||||||
| JiraUserInput | GithubUserInput | GitlabUserInput; | ||||||||||||
//| JiraServiceMgmtUserInput; | ||||||||||||
/* account */ | ||||||||||||
export type OriginalAccountInput = ZendeskAccountInput | FrontAccountInput; | ||||||||||||
|
@@ -163,20 +176,20 @@ export type OriginalTagInput = | |||||||||||
| FrontTagInput | ||||||||||||
| GorgiasTagInput | ||||||||||||
| JiraTagInput | ||||||||||||
| GitlabTagInput; | ||||||||||||
| GitlabTagInput | GithubTagInput; | ||||||||||||
|
||||||||||||
/* team */ | ||||||||||||
export type OriginalTeamInput = | ||||||||||||
| ZendeskTeamInput | ||||||||||||
| FrontTeamInput | ||||||||||||
| GorgiasTeamInput | ||||||||||||
| JiraTeamInput; | ||||||||||||
| JiraTeamInput | GithubTeamInput; | ||||||||||||
|
||||||||||||
/* attachment */ | ||||||||||||
export type OriginalAttachmentInput = null; | ||||||||||||
export type OriginalCollectionInput = | ||||||||||||
| JiraCollectionInput | ||||||||||||
| GitlabCollectionInput; | ||||||||||||
| GitlabCollectionInput | GithubCollectionInput; | ||||||||||||
|
||||||||||||
export type TicketingObjectInput = | ||||||||||||
| OriginalTicketInput | ||||||||||||
|
@@ -197,21 +210,21 @@ export type OriginalTicketOutput = | |||||||||||
| FrontTicketOutput | ||||||||||||
| GorgiasTicketOutput | ||||||||||||
| JiraTicketOutput | ||||||||||||
| GitlabTicketOutput; | ||||||||||||
| GitlabTicketOutput | GithubTicketOutput; | ||||||||||||
|
||||||||||||
/* comment */ | ||||||||||||
export type OriginalCommentOutput = | ||||||||||||
| ZendeskCommentOutput | ||||||||||||
| FrontCommentOutput | ||||||||||||
| GorgiasCommentOutput | ||||||||||||
| JiraCommentOutput | ||||||||||||
| GitlabCommentOutput; | ||||||||||||
| GitlabCommentOutput | GithubCommentOutput; | ||||||||||||
/* user */ | ||||||||||||
export type OriginalUserOutput = | ||||||||||||
| ZendeskUserOutput | ||||||||||||
| FrontUserOutput | ||||||||||||
| GorgiasUserOutput | ||||||||||||
| JiraUserOutput; | ||||||||||||
| JiraUserOutput | GithubUserOutput | GitlabUserOutput; | ||||||||||||
/* account */ | ||||||||||||
export type OriginalAccountOutput = ZendeskAccountOutput | FrontAccountOutput; | ||||||||||||
/* contact */ | ||||||||||||
|
@@ -226,14 +239,14 @@ export type OriginalTagOutput = | |||||||||||
| FrontTagOutput | ||||||||||||
| GorgiasTagOutput | ||||||||||||
| JiraTagOutput | ||||||||||||
| GitlabTagOutput; | ||||||||||||
| GitlabTagOutput | GithubTagOutput; | ||||||||||||
|
||||||||||||
/* team */ | ||||||||||||
export type OriginalTeamOutput = | ||||||||||||
| ZendeskTeamOutput | ||||||||||||
| FrontTeamOutput | ||||||||||||
| GorgiasTeamOutput | ||||||||||||
| JiraTeamOutput; | ||||||||||||
| JiraTeamOutput | GithubTeamOutput; | ||||||||||||
|
||||||||||||
/* attachment */ | ||||||||||||
export type OriginalAttachmentOutput = | ||||||||||||
|
@@ -246,7 +259,7 @@ export type OriginalAttachmentOutput = | |||||||||||
|
||||||||||||
export type OriginalCollectionOutput = | ||||||||||||
| JiraCollectionOutput | ||||||||||||
| GitlabCollectionOutput; | ||||||||||||
| GitlabCollectionOutput | GithubCollectionOutput; | ||||||||||||
|
||||||||||||
export type TicketingObjectOutput = | ||||||||||||
| OriginalTicketOutput | ||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,61 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { Injectable } from '@nestjs/common'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { LoggerService } from '@@core/@core-services/logger/logger.service'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { PrismaService } from '@@core/@core-services/prisma/prisma.service'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { EncryptionService } from '@@core/@core-services/encryption/encryption.service'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { TicketingObject } from '@ticketing/@lib/@types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ApiResponse } from '@@core/utils/types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import axios from 'axios'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ActionType, handle3rdPartyServiceError } from '@@core/utils/errors'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ServiceRegistry } from '../registry.service'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { ICollectionService } from '@ticketing/collection/types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { GithubCollectionInput, GithubCollectionOutput } from './types'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
import { SyncParam } from '@@core/utils/types/interface'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
@Injectable() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
export class GithubService implements ICollectionService { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
constructor( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private prisma: PrismaService, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private logger: LoggerService, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private cryptoService: EncryptionService, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
private registry: ServiceRegistry, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
this.logger.setContext( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
TicketingObject.collection.toUpperCase() + ':' + GithubService.name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
this.registry.registerService('github', this); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+14
to
+26
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use template literals for setting logger context. Template literals are preferred over string concatenation for better readability. - this.logger.setContext(
- TicketingObject.collection.toUpperCase() + ':' + GithubService.name,
- );
+ this.logger.setContext(`${TicketingObject.collection.toUpperCase()}:${GithubService.name}`); Committable suggestion
Suggested change
ToolsBiome
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
async sync(data: SyncParam): Promise<ApiResponse<GithubCollectionOutput[]>> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const { linkedUserId } = data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const connection = await this.prisma.connections.findFirst({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
where: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
id_linked_user: linkedUserId, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
provider_slug: 'github', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
vertical: 'ticketing', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const resp = await axios.get( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
`${connection.account_url}/user/repos`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
headers: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
'Content-Type': 'application/json', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Authorization: `Bearer ${this.cryptoService.decrypt( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
connection.access_token, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
)}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
this.logger.log(`Synced github collections !`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
data: resp.data, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
message: 'Github collections retrieved', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
statusCode: 200, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
throw error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+28
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove redundant catch clause. The catch clause that only rethrows the original error is redundant and can be removed. - } catch (error) {
- throw error;
- }
+ } Committable suggestion
Suggested change
ToolsBiome
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,71 @@ | ||||||||||
import { ICollectionMapper } from '@ticketing/collection/types'; | ||||||||||
import { GithubCollectionInput, GithubCollectionOutput } from './types'; | ||||||||||
import { | ||||||||||
UnifiedTicketingCollectionInput, | ||||||||||
UnifiedTicketingCollectionOutput, | ||||||||||
} from '@ticketing/collection/types/model.unified'; | ||||||||||
import { MappersRegistry } from '@@core/@core-services/registries/mappers.registry'; | ||||||||||
import { Injectable } from '@nestjs/common'; | ||||||||||
import { Utils } from '@ticketing/@lib/@utils'; | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
@Injectable() | ||||||||||
export class GithubCollectionMapper implements ICollectionMapper { | ||||||||||
constructor(private mappersRegistry: MappersRegistry, private utils: Utils) { | ||||||||||
this.mappersRegistry.registerService( | ||||||||||
'ticketing', | ||||||||||
'collection', | ||||||||||
'github', | ||||||||||
this, | ||||||||||
); | ||||||||||
} | ||||||||||
desunify( | ||||||||||
source: UnifiedTicketingCollectionInput, | ||||||||||
customFieldMappings?: { | ||||||||||
slug: string; | ||||||||||
remote_id: string; | ||||||||||
}[], | ||||||||||
): GithubCollectionInput { | ||||||||||
return; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implement the The - ): GithubCollectionInput {
- return;
+ ): GithubCollectionInput {
+ // Implement the desunify logic here
+ return {} as GithubCollectionInput; Committable suggestion
Suggested change
|
||||||||||
} | ||||||||||
|
||||||||||
unify( | ||||||||||
source: GithubCollectionOutput | GithubCollectionOutput[], | ||||||||||
connectionId: string, | ||||||||||
customFieldMappings?: { | ||||||||||
slug: string; | ||||||||||
remote_id: string; | ||||||||||
}[], | ||||||||||
): UnifiedTicketingCollectionOutput | UnifiedTicketingCollectionOutput[] { | ||||||||||
// If the source is not an array, convert it to an array for mapping | ||||||||||
const sourcesArray = Array.isArray(source) ? source : [source]; | ||||||||||
|
||||||||||
return sourcesArray.map((collection) => | ||||||||||
this.mapSingleCollectionToUnified( | ||||||||||
collection, | ||||||||||
connectionId, | ||||||||||
customFieldMappings, | ||||||||||
), | ||||||||||
); | ||||||||||
} | ||||||||||
|
||||||||||
private mapSingleCollectionToUnified( | ||||||||||
collection: GithubCollectionOutput, | ||||||||||
connectionId: string, | ||||||||||
customFieldMappings?: { | ||||||||||
slug: string; | ||||||||||
remote_id: string; | ||||||||||
}[], | ||||||||||
): UnifiedTicketingCollectionOutput { | ||||||||||
const unifiedCollection: UnifiedTicketingCollectionOutput = { | ||||||||||
remote_id: String(collection.id), | ||||||||||
remote_data: collection, | ||||||||||
name: collection.name, | ||||||||||
description: collection.description, | ||||||||||
collection_type: 'PROJECT', | ||||||||||
}; | ||||||||||
|
||||||||||
return unifiedCollection; | ||||||||||
} | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip
Codebase Verification
Ensure the new GitHub ticketing environment variables are documented.
The
GITHUB_TICKETING_CLOUD_CLIENT_ID
andGITHUB_TICKETING_CLOUD_CLIENT_SECRET
variables are listed indocs/open-source/self_hosting/envVariables.mdx
, but they lack descriptions and usage information. Please update the documentation to include detailed information on these variables.docs/open-source/self_hosting/envVariables.mdx
Analysis chain
Ensure the new GitHub ticketing environment variables are documented.
It is important to document these new environment variables in the project's documentation to guide developers on their usage.
Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 92
Script:
Length of output: 1175
Script:
Length of output: 494