-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/panoratech/Panora
- Loading branch information
Showing
38 changed files
with
1,123 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
packages/api/src/@core/connections/connections.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Controller, Get, Query, Res } from '@nestjs/common'; | ||
import { Response } from 'express'; // Importing the Express Response type for type checking | ||
import { CrmConnectionsService } from './crm/services/crm-connection.service'; | ||
import { ProviderVertical, getProviderVertical } from '../utils/providers'; | ||
import { LoggerService } from '../logger/logger.service'; | ||
|
||
@Controller('connections') | ||
export class ConnectionsController { | ||
constructor(private readonly crmConnectionsService: CrmConnectionsService) {} | ||
@Get('oauth/callback') | ||
handleCallback( | ||
@Res() res: Response, | ||
@Query('state') state: string, | ||
@Query('code') code: string, | ||
@Query('accountURL') zohoAccountURL?: string, | ||
) { | ||
try { | ||
if (!state || !code) throw new Error('no params found'); | ||
const stateData = JSON.parse(decodeURIComponent(state)); | ||
const { projectId, linkedUserId, providerName, returnUrl } = stateData; | ||
//TODO; ADD VERIFICATION OF PARAMS | ||
switch (getProviderVertical(providerName)) { | ||
case ProviderVertical.CRM: | ||
const zohoAccount = zohoAccountURL ? zohoAccountURL : ''; | ||
this.crmConnectionsService.handleCRMCallBack( | ||
projectId, | ||
linkedUserId, | ||
providerName, | ||
code, | ||
zohoAccount, | ||
); | ||
case ProviderVertical.ATS: | ||
break; | ||
case ProviderVertical.Accounting: | ||
break; | ||
case ProviderVertical.FileStorage: | ||
break; | ||
case ProviderVertical.HRIS: | ||
break; | ||
case ProviderVertical.MarketingAutomation: | ||
break; | ||
case ProviderVertical.Ticketing: | ||
break; | ||
case ProviderVertical.Unknown: | ||
break; | ||
} | ||
|
||
res.redirect(returnUrl); | ||
} catch (error) { | ||
console.error('An error occurred', error.response?.data || error.message); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { CrmConnectionModule } from './crm/crm-connection.module'; | ||
import { ConnectionsController } from './connections.controller'; | ||
import { LoggerService } from '../logger/logger.service'; | ||
|
||
@Module({ | ||
controllers: [ConnectionsController], | ||
imports: [CrmConnectionModule], | ||
}) | ||
export class ConnectionsModule {} |
30 changes: 0 additions & 30 deletions
30
packages/api/src/@core/connections/crm/crm-connection.controller.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
export const CRM_PROVIDERS = [ | ||
'zoho', | ||
'zendesk', | ||
'hubspot', | ||
'pipedrive', | ||
'freshsales', | ||
]; | ||
export const HRIS_PROVIDERS = []; | ||
export const ATS_PROVIDERS = []; | ||
export const ACCOUNTING_PROVIDERS = []; | ||
export const TICKETING_PROVIDERS = []; | ||
export const MARKETING_AUTOMATION_PROVIDERS = []; | ||
export const FILE_STORAGE_PROVIDERS = []; | ||
|
||
export enum ProviderVertical { | ||
CRM = 'CRM', | ||
HRIS = 'HRIS', | ||
ATS = 'ATS', | ||
Accounting = 'Accounting', | ||
Ticketing = 'Ticketing', | ||
MarketingAutomation = 'Marketing Automation', | ||
FileStorage = 'File Storage', | ||
Unknown = 'Unknown', // Used if the provider does not match any category | ||
} | ||
export function getProviderVertical(providerName: string): ProviderVertical { | ||
if (CRM_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.CRM; | ||
} | ||
if (HRIS_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.HRIS; | ||
} | ||
if (ATS_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.ATS; | ||
} | ||
if (ACCOUNTING_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.Accounting; | ||
} | ||
if (TICKETING_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.Ticketing; | ||
} | ||
if (MARKETING_AUTOMATION_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.MarketingAutomation; | ||
} | ||
if (FILE_STORAGE_PROVIDERS.includes(providerName)) { | ||
return ProviderVertical.FileStorage; | ||
} | ||
return ProviderVertical.Unknown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CLIENT_ID= #hubspot client id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
'@typescript-eslint/no-unused-vars': 'off', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
.env |
Oops, something went wrong.