Skip to content

Commit 693df43

Browse files
committed
feat: map (our) Jira to the multiple jira integrations from nango and adjust dependencies
1 parent 179e2ae commit 693df43

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

services/apps/cron_service/src/jobs/nangoConnectionCleanup.job.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,9 @@ const job: IJobDefinition = {
2929
await initNangoCloudClient()
3030
const dbConnection = await getDbConnection(READ_DB_CONFIG(), 3, 0)
3131

32-
const allIntegrations = await fetchNangoIntegrationData(
33-
pgpQx(dbConnection),
34-
ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform),
35-
)
32+
const allIntegrations = await fetchNangoIntegrationData(pgpQx(dbConnection), [
33+
...new Set(ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform)),
34+
])
3635

3736
const nangoConnections = await getNangoConnections()
3837

services/apps/cron_service/src/jobs/nangoMonitoring.job.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ const job: IJobDefinition = {
3434
await initNangoCloudClient()
3535
const dbConnection = await getDbConnection(READ_DB_CONFIG(), 3, 0)
3636

37-
const allIntegrations = await fetchNangoIntegrationData(
38-
pgpQx(dbConnection),
39-
ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform),
40-
)
37+
const allIntegrations = await fetchNangoIntegrationData(pgpQx(dbConnection), [
38+
...new Set(ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform)),
39+
])
4140

4241
const nangoConnections = await getNangoConnections()
4342

@@ -75,7 +74,9 @@ const job: IJobDefinition = {
7574
ctx.log.warn(`${int.platform} integration with id "${int.id}" is not connected to Nango!`)
7675
} else {
7776
const results = await getNangoConnectionStatus(
78-
int.platform as NangoIntegration,
77+
int.platform == PlatformType.JIRA
78+
? (int.settings.nangoIntegrationName as NangoIntegration)
79+
: (int.platform as NangoIntegration),
7980
nangoConnection.connection_id,
8081
)
8182

services/apps/cron_service/src/jobs/nangoTrigger.job.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@ const job: IJobDefinition = {
2828

2929
const dbConnection = await getDbConnection(READ_DB_CONFIG(), 3, 0)
3030

31-
const integrationsToTrigger = await fetchNangoIntegrationData(
32-
pgpQx(dbConnection),
33-
ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform),
34-
)
31+
const integrationsToTrigger = await fetchNangoIntegrationData(pgpQx(dbConnection), [
32+
...new Set(ALL_NANGO_INTEGRATIONS.map(nangoIntegrationToPlatform)),
33+
])
3534

3635
for (const int of integrationsToTrigger) {
3736
const { id, settings } = int
3837

39-
const platform = platformToNangoIntegration(int.platform as PlatformType)
38+
const platform = platformToNangoIntegration(int.platform as PlatformType, settings)
4039

4140
if (platform === NangoIntegration.GITHUB && !settings.nangoMapping) {
4241
// ignore non-nango github integrations

services/apps/nango_worker/src/bin/full-resync.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ setImmediate(async () => {
3030
)
3131

3232
if (integration) {
33-
const nangoIntegration = platformToNangoIntegration(integration.platform as PlatformType)
33+
const nangoIntegration = platformToNangoIntegration(
34+
integration.platform as PlatformType,
35+
integration.settings,
36+
)
3437

3538
try {
3639
const toTrigger: string[] = []

services/apps/nango_worker/src/bin/trigger-onboarding-for-model.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ setImmediate(async () => {
3434
log.info(
3535
`Triggering nango integration check for integrationId '${integrationId}' and connectionId '${connectionId}'!`,
3636
)
37-
const providerConfigKey = platformToNangoIntegration(integration.platform as PlatformType)
37+
const providerConfigKey = platformToNangoIntegration(
38+
integration.platform as PlatformType,
39+
integration.settings,
40+
)
3841

3942
await dbConnection.none(
4043
`

0 commit comments

Comments
 (0)