Skip to content

Commit

Permalink
Merge pull request #401 from panoratech/feat/updates-backend
Browse files Browse the repository at this point in the history
Feat/updates backend
  • Loading branch information
naelob authored Apr 29, 2024
2 parents c23d7e2 + 1491af0 commit cab4e56
Show file tree
Hide file tree
Showing 103 changed files with 1,368 additions and 1,989 deletions.
19 changes: 9 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

Your customers expect all of their tools to work well together. Panora avoids your team spending hundreds of hours building and maintaining integrations instead of your core product.


# ✨ Core Features

| |
Expand All @@ -38,11 +37,12 @@ Your customers expect all of their tools to work well together. Panora avoids yo
| **Passthrough Requests:** Interact with other software platforms in their native format. |
| **Webhooks:** Listen to one webhook to receive normalized data from various software platforms |


# ✨ Integrations Catalog

Panora supports integration with the following objects across multiple platforms:

### CRM
### CRM

| | Contacts | Deals | Notes | Engagements | Tasks | Users | Companies |
|-----------------------------------------------|:--------:|:-----:|:-----:|:-----------:|:-----:|:-----:|:---------:|
| Hubspot | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Expand All @@ -51,18 +51,16 @@ Panora supports integration with the following objects across multiple platforms
| Zendesk Sell | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
| Attio | ✔️ | | | | | | ✔️ |

### Ticketing

### Ticketing
| | Tickets | Comments | Users | Contacts | Accounts | Tags | Teams | Collections |
|-------------|:----------:|:-------:|:-------:|:------------:|:-------:|:-------:|:------:|:-------------:|
| Zendesk |||||||| |
| Front |||||||| |
| Zendesk |||||||| |
| Front |||||||| |
| Jira |||| | ||||
| Gorgias ||||| ||||

Your favourite software is missing? [Ask the community to build a connector!](https://github.com/panoratech/Panora/issues/new)

| Gorgias ||||| ||| |

Your favourite software is missing? [Ask the community to build a connector!](https://github.com/panoratech/Panora/issues/new)

# 🕹️ Try the Open-Source version

Expand All @@ -85,6 +83,7 @@ Your favourite software is missing? [Ask the community to build a connector!](ht
```
docker compose up
```

Visit our [Quickstart Guide](https://docs.panora.dev/quick-start) to start adding integrations to your product

# 🤔 Questions? Ask the core team
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,11 @@ export class ConnectionsStrategiesService {
.scopes,
};
}
const isSubdomain = needsSubdomain(
/*const isSubdomain = needsSubdomain(
provider.toLowerCase(),
vertical.toLowerCase(),
);
console.log('needs subdomain ??? ' + isSubdomain);
);*/
// console.log('needs subdomain ??? ' + isSubdomain);
if (needsSubdomain(provider.toLowerCase(), vertical.toLowerCase())) {
data = {
...data,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/@core/connections/@utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class ConnectionUtils {
token: string,
): Promise<ConnectionMetadata> {
try {
console.log('token is ' + token);
// console.log('token is ' + token);
if (!token)
throw new Error('token provided for connection token is invalid');
const res = await this.prisma.connections.findFirst({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class ConnectionsController {
}
}

@Get('gorgias/oauth/install')
@Get('/gorgias/oauth/install')
handleGorgiasAuthUrl(
@Res() res: Response,
@Query('account') account: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ export class AcceloConnectionService implements ICrmConnectionService {
async handleCallback(opts: CallbackParams) {
try {
const { linkedUserId, projectId, code } = opts;
this.logger.log(
'linkeduserid is ' + linkedUserId + ' inside callback accelo',
);
// this.logger.log('linkeduserid is ' + linkedUserId + ' inside callback accelo',);
const isNotUnique = await this.prisma.connections.findFirst({
where: {
id_linked_user: linkedUserId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class CrmConnectionsService {
location: zohoLocation || null,
};
const data: Connection = await service.handleCallback(callbackOpts);
this.logger.log('data is ' + data);
// this.logger.log('data is ' + data);
const event = await this.prisma.events.create({
data: {
id_event: uuidv4(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ export class HubspotConnectionService implements ICrmConnectionService {
async handleCallback(opts: CallbackParams) {
try {
const { linkedUserId, projectId, code } = opts;
this.logger.log(
/* this.logger.log(
'linkeduserid is ' + linkedUserId + ' inside callback hubspot',
);
);*/
const isNotUnique = await this.prisma.connections.findFirst({
where: {
id_linked_user: linkedUserId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
ITicketingConnectionService,
} from '../../types';
import { ServiceRegistry } from '../registry.service';
import { OAuth2AuthData, providerToType } from '@panora/shared';
import {
OAuth2AuthData,
providersConfig,
providerToType,
} from '@panora/shared';
import { AuthStrategy } from '@panora/shared';
import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service';

Expand Down Expand Up @@ -84,6 +88,9 @@ export class GorgiasConnectionService implements ITicketingConnectionService {

let db_res;
const connection_token = uuidv4();
const BASE_API_URL =
CREDENTIALS.SUBDOMAIN +
providersConfig['ticketing']['gorgias'].urls.apiUrl;

if (isNotUnique) {
db_res = await this.prisma.connections.update({
Expand All @@ -93,7 +100,7 @@ export class GorgiasConnectionService implements ITicketingConnectionService {
data: {
access_token: this.cryptoService.encrypt(data.access_token),
refresh_token: this.cryptoService.encrypt(data.refresh_token),
account_url: CREDENTIALS.SUBDOMAIN!,
account_url: BASE_API_URL,
expiration_timestamp: new Date(
new Date().getTime() + Number(data.expires_in) * 1000,
),
Expand All @@ -109,7 +116,7 @@ export class GorgiasConnectionService implements ITicketingConnectionService {
provider_slug: 'gorgias',
vertical: 'ticketing',
token_type: 'oauth',
account_url: CREDENTIALS.SUBDOMAIN!,
account_url: BASE_API_URL,
access_token: this.cryptoService.encrypt(data.access_token),
refresh_token: this.cryptoService.encrypt(data.refresh_token),
expiration_timestamp: new Date(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
ITicketingConnectionService,
} from '../../types';
import { ServiceRegistry } from '../registry.service';
import { AuthStrategy } from '@panora/shared';
import { AuthStrategy, providersConfig } from '@panora/shared';
import { OAuth2AuthData, providerToType } from '@panora/shared';
import { ConnectionsStrategiesService } from '@@core/connections-strategies/connections-strategies.service';

Expand Down Expand Up @@ -65,9 +65,8 @@ export class ZendeskConnectionService implements ITicketingConnectionService {
scope: 'read',
});

//const subdomain = 'panora7548';
const res = await axios.post(
`${CREDENTIALS.SUBDOMAIN!}/oauth/tokens`,
`${CREDENTIALS.SUBDOMAIN}/oauth/tokens`,
formData.toString(),
{
headers: {
Expand All @@ -82,6 +81,9 @@ export class ZendeskConnectionService implements ITicketingConnectionService {

let db_res;
const connection_token = uuidv4();
const BASE_API_URL =
CREDENTIALS.SUBDOMAIN +
providersConfig['ticketing']['zendesk'].urls.apiUrl;

if (isNotUnique) {
db_res = await this.prisma.connections.update({
Expand All @@ -90,7 +92,7 @@ export class ZendeskConnectionService implements ITicketingConnectionService {
},
data: {
access_token: this.cryptoService.encrypt(data.access_token),
account_url: CREDENTIALS.SUBDOMAIN!,
account_url: BASE_API_URL,
refresh_token: '',
expiration_timestamp: new Date(), //TODO
status: 'valid',
Expand All @@ -105,7 +107,7 @@ export class ZendeskConnectionService implements ITicketingConnectionService {
provider_slug: 'zendesk',
vertical: 'ticketing',
token_type: 'oauth',
account_url: CREDENTIALS.SUBDOMAIN!,
account_url: BASE_API_URL,
access_token: this.cryptoService.encrypt(data.access_token),
refresh_token: '',
expiration_timestamp: new Date(), //TODO
Expand Down
53 changes: 2 additions & 51 deletions packages/api/src/@core/utils/types/original/original.ticketing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,24 @@ import {
FrontAccountInput,
FrontAccountOutput,
} from '@ticketing/account/services/front/types';
import {
GithubAccountInput,
GithubAccountOutput,
} from '@ticketing/account/services/github/types';
import { FrontAttachmentOutput } from '@ticketing/attachment/services/front/types';
import { GithubAttachmentOutput } from '@ticketing/attachment/services/github/types';
import { ZendeskAttachmentOutput } from '@ticketing/attachment/services/zendesk/types';
import {
FrontCommentInput,
FrontCommentOutput,
} from '@ticketing/comment/services/front/types';
import {
GithubCommentInput,
GithubCommentOutput,
} from '@ticketing/comment/services/github/types';
import {
HubspotCommentInput,
HubspotCommentOutput,
} from '@ticketing/comment/services/hubspot/types';
import {
FrontContactInput,
FrontContactOutput,
} from '@ticketing/contact/services/front/types';
import {
GithubContactInput,
GithubContactOutput,
} from '@ticketing/contact/services/github/types';
import {
FrontTagInput,
FrontTagOutput,
} from '@ticketing/tag/services/front/types';
import {
GithubTagInput,
GithubTagOutput,
} from '@ticketing/tag/services/github/types';
import {
FrontTeamInput,
FrontTeamOutput,
} from '@ticketing/team/services/front/types';
import {
GithubTeamInput,
GithubTeamOutput,
} from '@ticketing/team/services/github/types';
import {
FrontTicketInput,
FrontTicketOutput,
Expand All @@ -61,11 +36,6 @@ import {
FrontUserInput,
FrontUserOutput,
} from '@ticketing/user/services/front/types';
import {
GithubUserInput,
GithubUserOutput,
} from '@ticketing/user/services/github/types';

import {
GorgiasTicketInput,
GorgiasTicketOutput,
Expand Down Expand Up @@ -158,42 +128,33 @@ export type OriginalTicketInput =
export type OriginalCommentInput =
| ZendeskCommentInput
| FrontCommentInput
| GithubCommentInput
| HubspotCommentInput
| GorgiasCommentInput
| JiraCommentInput;
//| JiraCommentServiceMgmtInput;
/* user */
export type OriginalUserInput =
| ZendeskUserInput
| GithubUserInput
| FrontUserInput
| GorgiasUserInput
| JiraUserInput;
//| JiraServiceMgmtUserInput;
/* account */
export type OriginalAccountInput =
| ZendeskAccountInput
| GithubAccountInput
| FrontAccountInput;
export type OriginalAccountInput = ZendeskAccountInput | FrontAccountInput;
/* contact */
export type OriginalContactInput =
| ZendeskContactInput
| GithubContactInput
| FrontContactInput
| GorgiasContactInput;

/* tag */
export type OriginalTagInput =
| ZendeskTagInput
| GithubTagInput
| FrontTagInput
| GorgiasTagInput
| JiraTagInput;
/* team */
export type OriginalTeamInput =
| ZendeskTeamInput
| GithubTeamInput
| FrontTeamInput
| GorgiasTeamInput
| JiraTeamInput;
Expand Down Expand Up @@ -228,41 +189,32 @@ export type OriginalTicketOutput =
export type OriginalCommentOutput =
| ZendeskCommentOutput
| FrontCommentOutput
| GithubCommentOutput
| HubspotCommentOutput
| GorgiasCommentOutput
| JiraCommentOutput;
/* user */
export type OriginalUserOutput =
| ZendeskUserOutput
| GithubUserOutput
| FrontUserOutput
| GorgiasUserOutput
| JiraUserOutput;
/* account */
export type OriginalAccountOutput =
| ZendeskAccountOutput
| GithubAccountOutput
| FrontAccountOutput;
export type OriginalAccountOutput = ZendeskAccountOutput | FrontAccountOutput;
/* contact */
export type OriginalContactOutput =
| ZendeskContactOutput
| GithubContactOutput
| FrontContactOutput
| GorgiasContactOutput;

/* tag */
export type OriginalTagOutput =
| ZendeskTagOutput
| GithubTagOutput
| FrontTagOutput
| GorgiasTagOutput
| JiraTagOutput;

/* team */
export type OriginalTeamOutput =
| ZendeskTeamOutput
| GithubTeamOutput
| FrontTeamOutput
| GorgiasTeamOutput
| JiraTeamOutput;
Expand All @@ -271,7 +223,6 @@ export type OriginalTeamOutput =
export type OriginalAttachmentOutput =
| ZendeskAttachmentOutput
| FrontAttachmentOutput
| GithubAttachmentOutput
| GorgiasAttachmentOutput
| JiraAttachmentOutput;

Expand Down
12 changes: 7 additions & 5 deletions packages/api/src/crm/company/services/attio/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,15 @@ export class AttioCompanyMapper implements ICompanyMapper {
value: source.name,
},
],
categories: [
{
option: source.industry,
},
],
},
};
if (source.industry) {
result.values.categories = [
{
option: source.industry,
},
];
}
// const result: AttioCompanyInput = {
// city: '',
// name: source.name,
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/crm/company/services/company.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export class CompanyService {
unique_crm_company_id = res.id_crm_company;
} else {
// Create a new company
this.logger.log('company not exists');
// this.logger.log('company not exists');
const uuid = uuidv4();
let data: any = {
id_crm_company: uuid,
Expand Down
Loading

0 comments on commit cab4e56

Please sign in to comment.