diff --git a/packages/api/package.json b/packages/api/package.json index 7a6ad2eaf..267178c18 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -22,7 +22,8 @@ "test:e2e": "jest --config ./test/jest-e2e.json", "ci": "pnpm run lint && pnpm run build", "copy-types-to-shared": "cp ./exports.ts ../shared/index.ts", - "prisma:seed": "ts-node ./scripts/seed.webapp.ts" + "prisma:seed": "ts-node ./scripts/seed.webapp.ts", + "validate-connectors": "node ./scripts/connectorUpdate.js" }, "dependencies": { "@nestjs/bull": "^10.0.1", @@ -60,7 +61,8 @@ "reflect-metadata": "^0.1.13", "rxjs": "^7.8.1", "stytch": "^10.5.0", - "uuid": "^9.0.1" + "uuid": "^9.0.1", + "yargs": "^17.7.2" }, "devDependencies": { "@nestjs/cli": "^10.0.0", diff --git a/packages/api/scripts/connectorUpdate.js b/packages/api/scripts/connectorUpdate.js index 3c1de8fb5..096ecf10c 100755 --- a/packages/api/scripts/connectorUpdate.js +++ b/packages/api/scripts/connectorUpdate.js @@ -2,6 +2,8 @@ import { log } from 'console'; import * as fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; +import yargs from 'yargs'; +import { hideBin } from 'yargs/helpers'; // Function to scan the directory for new service directories function scanDirectory(dir) { @@ -326,4 +328,25 @@ function updateObjectTypes(baseDir, objectType, vertical) { } // Example usage for ticketing/team -updateObjectTypes('../src/ticketing/team/services', 'Team', 'ticketing'); +//updateObjectTypes('../src/ticketing/team/services', 'Team', 'ticketing'); + +// Check if the script is being run directly +if (import.meta.url === process.argv[1]) { + // Get command-line arguments + const args = process.argv.slice(1); + const vertical = args[0]; + const objectType = args[1]; + const baseDir = `../src/${vertical.toLowerCase()}/${objectType.toLowerCase()}/services`; + updateObjectTypes(baseDir, objectType, vertical); +} + +/*const options = yargs.usage('Usage: -vertical ').option('v', { + alias: 'vertical', + describe: 'Your vertical', + type: 'string', + demandOption: true, +}).argv;*/ +const argv = yargs(hideBin(process.argv)).argv; + +const baseDir = `../src/${argv.vertical.toLowerCase()}/${argv.object.toLowerCase()}/services`; +updateObjectTypes(baseDir, argv.object, argv.vertical); diff --git a/packages/api/src/@core/utils/types/original/original.ticketing.ts b/packages/api/src/@core/utils/types/original/original.ticketing.ts index 2633d2c7d..47b873dd9 100644 --- a/packages/api/src/@core/utils/types/original/original.ticketing.ts +++ b/packages/api/src/@core/utils/types/original/original.ticketing.ts @@ -1,18 +1,7 @@ - - - - - - -import { ClickupTeamInput, ClickupTeamOutput } from '@ticketing/team/services/clickup/types'; - - - - - - - - +import { + ClickupTeamInput, + ClickupTeamOutput, +} from '@ticketing/team/services/clickup/types'; import { FrontAccountInput, diff --git a/packages/api/src/ticketing/team/team.module.ts b/packages/api/src/ticketing/team/team.module.ts index b6b83ebc0..76839eb6a 100644 --- a/packages/api/src/ticketing/team/team.module.ts +++ b/packages/api/src/ticketing/team/team.module.ts @@ -37,7 +37,8 @@ import { GorgiasService } from './services/gorgias'; FrontService, GithubService, JiraService, - GorgiasService, ClickupService, + GorgiasService, + ClickupService, ], exports: [SyncService], }) diff --git a/packages/api/src/ticketing/team/types/mappingsTypes.ts b/packages/api/src/ticketing/team/types/mappingsTypes.ts index 4e93d9305..8ef99fd0e 100644 --- a/packages/api/src/ticketing/team/types/mappingsTypes.ts +++ b/packages/api/src/ticketing/team/types/mappingsTypes.ts @@ -1,3 +1,8 @@ +import { ClickupteamMapper } from '../services/clickup/mappers'; +import { FrontteamMapper } from '../services/front/mappers'; +import { GithubteamMapper } from '../services/github/mappers'; +import { GorgiasteamMapper } from '../services/gorgias/mappers'; +import { JirateamMapper } from '../services/jira/mappers'; import { ClickupTeamMapper } from '../services/clickup/mappers'; import { JiraTeamMapper } from '../services/jira/mappers'; import { FrontTeamMapper } from '../services/front/mappers'; @@ -13,6 +18,11 @@ const jiraTeamMapper = new JiraTeamMapper(); const clickupTeamMapper = new ClickupTeamMapper(); +const clickupteamMapper = new ClickupteamMapper(); +const frontteamMapper = new FrontteamMapper(); +const githubteamMapper = new GithubteamMapper(); +const gorgiasteamMapper = new GorgiasteamMapper(); +const jirateamMapper = new JirateamMapper(); export const teamUnificationMapping = { zendesk_tcg: { unify: zendeskTeamMapper.unify.bind(zendeskTeamMapper), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7f2d7579e..cb5ce3cca 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -423,6 +423,9 @@ importers: uuid: specifier: ^9.0.1 version: 9.0.1 + yargs: + specifier: ^17.7.2 + version: 17.7.2 devDependencies: '@nestjs/cli': specifier: ^10.0.0