Skip to content

Commit 53ad142

Browse files
Nango integration & Removal of tenantId from many places (#2870)
Co-authored-by: Joana Maia <[email protected]>
1 parent 73ab3b3 commit 53ad142

File tree

268 files changed

+8578
-8069
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

268 files changed

+8578
-8069
lines changed

backend/.env.dist.local

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,5 @@ CROWD_QUESTDB_SQL_PASSWORD=quest
165165
CROWD_QUESTDB_SQL_DATABASE=qdb
166166
CROWD_QUESTDB_ILP_HOST=localhost
167167
CROWD_QUESTDB_ILP_PORT=9000
168+
169+
CROWD_GITHUB_IS_SNOWFLAKE_ENABLED=false

backend/config/custom-environment-variables.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@
127127
},
128128
"nango": {
129129
"url": "CROWD_NANGO_URL",
130-
"secretKey": "CROWD_NANGO_SECRET_KEY"
130+
"secretKey": "CROWD_NANGO_SECRET_KEY",
131+
"cloudSecretKey": "NANGO_CLOUD_SECRET_KEY",
132+
"cloudIntegrations": "NANGO_CLOUD_INTEGRATIONS"
131133
},
132134
"enrichment": {
133135
"url": "CROWD_ENRICHMENT_PROGAI_URL",

backend/config/default.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@
5252
"openStatusApi": {},
5353
"gitlab": {},
5454
"jiraIssueReporter": {},
55-
"snowflake": {}
55+
"snowflake": {},
56+
"nango": {}
5657
}

backend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,15 @@
5454
"@crowd/data-access-layer": "workspace:*",
5555
"@crowd/integrations": "workspace:*",
5656
"@crowd/logging": "workspace:*",
57+
"@crowd/nango": "workspace:*",
5758
"@crowd/opensearch": "workspace:*",
5859
"@crowd/questdb": "workspace:*",
5960
"@crowd/queue": "workspace:*",
6061
"@crowd/redis": "workspace:*",
62+
"@crowd/snowflake": "workspace:*",
6163
"@crowd/telemetry": "workspace:*",
6264
"@crowd/temporal": "workspace:*",
6365
"@crowd/types": "workspace:*",
64-
"@crowd/snowflake": "workspace:*",
6566
"@google-cloud/storage": "5.3.0",
6667
"@octokit/auth-app": "^3.6.1",
6768
"@octokit/core": "^6.1.2",

backend/src/api/activity/activityAddWithMember.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import PermissionChecker from '../../services/user/permissionChecker'
88
* @tag Activities
99
* @security Bearer
1010
* @description Create or update an activity with a member
11-
* Activity existence is checked by sourceId and tenantId
11+
* Activity existence is checked by sourceId
1212
* Member existence is checked by platform and username
1313
* @bodyContent {ActivityUpsertWithMemberInput} application/json
1414
* @response 200 - Ok

backend/src/api/apiResponseHandler.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,12 @@ export default class ApiResponseHandler extends LoggerBase {
4646
} else if (error && error.message === 'stream is not readable') {
4747
res.status(400).send('Request interrupted')
4848
} else {
49-
if (!error.code) {
49+
if (error.code && (!Number.isInteger(error.code) || error.code < 100 || error.code > 599)) {
50+
error.code = 500
51+
} else if (!error.code) {
5052
error.code = 500
5153
}
54+
5255
req.log.error(
5356
error,
5457
{ code: error.code, url: req.url, method: req.method, query: req.query, body: req.body },

backend/src/api/auth/authSignIn.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getDefaultTenantId } from '@crowd/common'
1+
import { DEFAULT_TENANT_ID } from '@crowd/common'
22

33
import AuthService from '../../services/auth/authService'
44

@@ -7,7 +7,7 @@ export default async (req, res) => {
77
req.body.email,
88
req.body.password,
99
req.body.invitationToken,
10-
getDefaultTenantId(),
10+
DEFAULT_TENANT_ID,
1111
req,
1212
)
1313

backend/src/api/auth/authSignUp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getDefaultTenantId } from '@crowd/common'
1+
import { DEFAULT_TENANT_ID } from '@crowd/common'
22

33
import AuthService from '../../services/auth/authService'
44

@@ -10,7 +10,7 @@ export default async (req, res) => {
1010
req.body.email,
1111
req.body.password,
1212
req.body.invitationToken,
13-
getDefaultTenantId(),
13+
DEFAULT_TENANT_ID,
1414
req.body.firstName,
1515
req.body.lastName,
1616
req.body.acceptedTermsAndPrivacy,

backend/src/api/auth/authSocial.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import passport from 'passport'
22

3-
import { getDefaultTenantId } from '@crowd/common'
3+
import { DEFAULT_TENANT_ID } from '@crowd/common'
44
import { getServiceChildLogger } from '@crowd/logging'
55

66
import { API_CONFIG, GITHUB_CONFIG, GOOGLE_CONFIG } from '../../conf'
@@ -22,7 +22,7 @@ export default (app, routes) => {
2222
routes.post('/auth/social/onboard', async (req, res) => {
2323
const payload = await AuthService.handleOnboard(
2424
req.currentUser,
25-
{ invitationToken: req.body.invitationToken, tenantId: getDefaultTenantId() },
25+
{ invitationToken: req.body.invitationToken, tenantId: DEFAULT_TENANT_ID },
2626
req,
2727
)
2828

backend/src/api/auth/ssoCallback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import jwt from 'jsonwebtoken'
22
import jwksClient from 'jwks-rsa'
33

4-
import { Error401, getDefaultTenantId } from '@crowd/common'
4+
import { DEFAULT_TENANT_ID, Error401 } from '@crowd/common'
55

66
import { AUTH0_CONFIG } from '../../conf'
77
import AuthService from '../../services/auth/authService'
@@ -22,7 +22,7 @@ async function getKey(header, callback) {
2222

2323
export default async (req, res) => {
2424
const { idToken, invitationToken } = req.body
25-
const tenantId = getDefaultTenantId()
25+
const tenantId = DEFAULT_TENANT_ID
2626

2727
try {
2828
const verifyToken = new Promise((resolve, reject) => {

0 commit comments

Comments
 (0)