Skip to content

Commit

Permalink
Add dependencies for github via script
Browse files Browse the repository at this point in the history
  • Loading branch information
mit-27 committed Jul 25, 2024
1 parent cb092b7 commit 420a7f9
Show file tree
Hide file tree
Showing 19 changed files with 130 additions and 176 deletions.
126 changes: 9 additions & 117 deletions packages/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ model crm_contacts {
model crm_deals {
id_crm_deal String @id(map: "pk_crm_deal") @db.Uuid
name String
description String?
description String
amount BigInt
created_at DateTime @db.Timestamp(6)
modified_at DateTime @db.Timestamp(6)
Expand Down Expand Up @@ -499,7 +499,6 @@ model tcg_collections {
remote_platform String?
collection_type String?
parent_collection String? @db.Uuid
id_tcg_ticket String? @db.Uuid
created_at DateTime @db.Timestamp(6)
modified_at DateTime @db.Timestamp(6)
id_linked_user String @db.Uuid
Expand All @@ -514,14 +513,14 @@ model tcg_comments {
is_private Boolean?
remote_id String?
remote_platform String?
created_at DateTime? @db.Timestamp(6)
modified_at DateTime? @db.Timestamp(6)
creator_type String?
id_tcg_attachment String[]
id_tcg_ticket String? @db.Uuid
id_tcg_contact String? @db.Uuid
id_tcg_user String? @db.Uuid
id_linked_user String? @db.Uuid
created_at DateTime? @db.Timestamp(6)
modified_at DateTime? @db.Timestamp(6)
id_connection String @db.Uuid
tcg_attachments tcg_attachments[]
tcg_tickets tcg_tickets? @relation(fields: [id_tcg_ticket], references: [id_tcg_ticket], onDelete: NoAction, onUpdate: NoAction, map: "fk_40_1")
Expand Down Expand Up @@ -592,14 +591,14 @@ model tcg_tickets {
collections String[]
completed_at DateTime? @db.Timestamp(6)
priority String?
created_at DateTime @db.Timestamp(6)
modified_at DateTime @db.Timestamp(6)
assigned_to String[]
remote_id String?
remote_platform String?
creator_type String?
id_tcg_user String? @db.Uuid
id_linked_user String? @db.Uuid
created_at DateTime @db.Timestamp(6)
modified_at DateTime @db.Timestamp(6)
id_linked_user String @db.Uuid
id_connection String @db.Uuid
tcg_attachments tcg_attachments[]
tcg_comments tcg_comments[]
Expand All @@ -616,10 +615,10 @@ model tcg_users {
remote_id String?
remote_platform String?
teams String[]
id_linked_user String? @db.Uuid
id_connection String @db.Uuid
created_at DateTime? @db.Timestamp(6)
modified_at DateTime? @db.Timestamp(6)
id_linked_user String? @db.Uuid
id_connection String @db.Uuid
tcg_comments tcg_comments[]
}

Expand Down Expand Up @@ -674,6 +673,7 @@ model connector_sets {
crm_zendesk Boolean?
crm_close Boolean?
fs_box Boolean?
tcg_github Boolean?
projects projects[]
}

Expand Down Expand Up @@ -1635,111 +1635,3 @@ model acc_vendor_credits {
tracking_categories String[]
accounting_period String? @db.Uuid
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model ecom_customer_addresses {
id_ecom_customer_address String @id(map: "pk_ecom_customer_addresses") @db.Uuid
address_type String?
line_1 String?
line_2 String?
street_1 String?
street_2 String?
city String?
state String?
postal_code String?
country String?
id_ecom_customer String @db.Uuid
modified_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
ecom_customers ecom_customers @relation(fields: [id_ecom_customer], references: [id_ecom_customer], onDelete: NoAction, onUpdate: NoAction, map: "fk_ecom_customer_customeraddress")
@@index([id_ecom_customer], map: "fk_index_ecom_customer_customeraddress")
}

model ecom_customers {
id_ecom_customer String @id(map: "pk_ecom_customers") @db.Uuid
remote_id String?
email String?
first_name String?
last_name String?
phone_number String?
modifed_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
id_connection String @db.Uuid
ecom_customer_addresses ecom_customer_addresses[]
ecom_orders ecom_orders[]
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model ecom_fulfilments {
id_ecom_fulfilment String @id(map: "pk_ecom_fulfilments") @db.Uuid
carrier String?
tracking_urls String[]
tracking_numbers String[]
items Json?
remote_id String?
id_ecom_order String? @db.Uuid
id_connection String @db.Uuid
modifed_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
ecom_orders ecom_orders? @relation(fields: [id_ecom_order], references: [id_ecom_order], onDelete: NoAction, onUpdate: NoAction, map: "fk_ecom_order_fulfilment")
@@index([id_ecom_order], map: "fk_index_ecom_order_fulfilment")
}

model ecom_orders {
id_ecom_order String @id(map: "pk_ecom_orders") @db.Uuid
order_status String?
order_number String?
payment_status String?
currency String?
total_price BigInt?
total_discount BigInt?
total_shipping BigInt?
total_tax BigInt?
fulfillment_status String?
remote_id String?
id_ecom_customer String? @db.Uuid
id_connection String @db.Uuid
modifed_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
ecom_fulfilments ecom_fulfilments[]
ecom_customers ecom_customers? @relation(fields: [id_ecom_customer], references: [id_ecom_customer], onDelete: NoAction, onUpdate: NoAction, map: "fk_ecom_customer_orders")
@@index([id_ecom_customer], map: "fk_index_ecom_customer_orders")
}

/// This model or at least one of its fields has comments in the database, and requires an additional setup for migrations: Read more: https://pris.ly/d/database-comments
model ecom_product_variants {
id_ecom_product_variant String @id(map: "pk_ecom_product_variants") @db.Uuid
id_connection String @db.Uuid
remote_id String?
title String?
price BigInt?
sku String?
options Json?
weight BigInt?
inventory_quantity BigInt?
id_ecom_product String? @db.Uuid
modifed_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
ecom_products ecom_products? @relation(fields: [id_ecom_product], references: [id_ecom_product], onDelete: NoAction, onUpdate: NoAction, map: "fk_ecom_products_variants")
@@index([id_ecom_product], map: "fk_index_ecom_products_variants")
}

model ecom_products {
id_ecom_product String @id(map: "pk_ecom_products") @db.Uuid
remote_id String?
product_url String?
product_type String?
product_status String?
images_urls String[]
description String?
vendor String?
tags String[]
modifed_at DateTime @db.Timestamptz(6)
created_at DateTime @db.Timestamptz(6)
id_connection String @db.Uuid
ecom_product_variants ecom_product_variants[]
}
3 changes: 2 additions & 1 deletion packages/api/scripts/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,8 @@ CREATE TABLE connector_sets
crm_zendesk boolean NULL,
crm_close boolean NULL,
fs_box boolean NULL,
CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set )
tcg_github boolean NULL,
CONSTRAINT PK_project_connector PRIMARY KEY ( id_connector_set )
);


Expand Down
8 changes: 4 additions & 4 deletions packages/api/scripts/seed.sql
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', 'pool', '0ce39030-2901-4c56-8db0-5e326182ec6b', '1709da40-17f7-4d3a-93a0-96dc5da6ddd7'),
Expand Down
37 changes: 25 additions & 12 deletions packages/api/src/@core/utils/types/original/original.ticketing.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
import { GithubCollectionInput, GithubCollectionOutput } from '@ticketing/collection/services/github/types';

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,
Expand Down Expand Up @@ -131,7 +144,7 @@ export type OriginalTicketInput =
| FrontTicketInput
| GorgiasTicketInput
| JiraTicketInput
| GitlabTicketInput;
| GitlabTicketInput | GithubTicketInput;
//| JiraServiceMgmtTicketInput;

/* comment */
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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 */
Expand All @@ -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 =
Expand All @@ -246,7 +259,7 @@ export type OriginalAttachmentOutput =

export type OriginalCollectionOutput =
| JiraCollectionOutput
| GitlabCollectionOutput;
| GitlabCollectionOutput | GithubCollectionOutput;

export type TicketingObjectOutput =
| OriginalTicketOutput
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/ticketing/collection/collection.module.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { GithubCollectionMapper } from './services/github/mappers';
import { GithubService } from './services/github';
import { EncryptionService } from '@@core/@core-services/encryption/encryption.service';
import { LoggerService } from '@@core/@core-services/logger/logger.service';
import { BullQueueModule } from '@@core/@core-services/queues/queue.module';
Expand Down Expand Up @@ -36,6 +38,8 @@ import { IngestDataService } from '@@core/@core-services/unification/ingest-data
/* PROVIDERS MAPPERS */
JiraCollectionMapper,
GitlabCollectionMapper,
GithubService,
GithubCollectionMapper,
],
exports: [SyncService, ServiceRegistry, WebhookService],
})
Expand Down
14 changes: 8 additions & 6 deletions packages/api/src/ticketing/collection/services/github/mappers.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { ICollectionMapper } from '@ticketing/collection/types';
import { GithubCollectionInput, GithubCollectionOutput } from './types';
import {
UnifiedCollectionInput,
UnifiedCollectionOutput,
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) {
Expand All @@ -19,7 +21,7 @@ export class GithubCollectionMapper implements ICollectionMapper {
);
}
desunify(
source: UnifiedCollectionInput,
source: UnifiedTicketingCollectionInput,
customFieldMappings?: {
slug: string;
remote_id: string;
Expand All @@ -35,7 +37,7 @@ export class GithubCollectionMapper implements ICollectionMapper {
slug: string;
remote_id: string;
}[],
): UnifiedCollectionOutput | UnifiedCollectionOutput[] {
): UnifiedTicketingCollectionOutput | UnifiedTicketingCollectionOutput[] {
// If the source is not an array, convert it to an array for mapping
const sourcesArray = Array.isArray(source) ? source : [source];

Expand All @@ -55,8 +57,8 @@ export class GithubCollectionMapper implements ICollectionMapper {
slug: string;
remote_id: string;
}[],
): UnifiedCollectionOutput {
const unifiedCollection: UnifiedCollectionOutput = {
): UnifiedTicketingCollectionOutput {
const unifiedCollection: UnifiedTicketingCollectionOutput = {
remote_id: String(collection.id),
remote_data: collection,
name: collection.name,
Expand Down
Loading

0 comments on commit 420a7f9

Please sign in to comment.