Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
replaceDoubleQuotes,
setAttributesDefaultValues,
} from '@crowd/common'
import { CommonMemberService } from '@crowd/common_services'
import {
changeMemberOrganizationAffiliationOverrides,
checkOrganizationAffiliationPolicy,
Expand Down Expand Up @@ -287,7 +288,9 @@
hasContributions: boolean,
isHighConfidenceSourceSelectedForWorkExperiences: boolean,
): Promise<boolean> {
return await svc.postgres.writer.transactionally(async (tx) => {
const affectedOrgIds: string[] = []

const updated = await svc.postgres.writer.transactionally(async (tx) => {
let updated = false
const qx = dbStoreQx(tx)
Comment thread
ulemons marked this conversation as resolved.
Outdated

Expand Down Expand Up @@ -460,6 +463,7 @@
if (results.toDelete.length > 0) {
for (const org of results.toDelete) {
updated = true
affectedOrgIds.push(org.orgId)
await deleteMemberOrgById(tx.transaction(), org.id)
}
}
Expand All @@ -470,6 +474,7 @@
throw new Error('Organization ID is missing!')
}
updated = true
affectedOrgIds.push(org.organizationId)

const newMemberOrgId = await insertWorkExperience(
tx.transaction(),
Expand All @@ -493,6 +498,7 @@
if (results.toUpdate.size > 0) {
for (const [memberOrg, toUpdate] of results.toUpdate) {
updated = true
affectedOrgIds.push(memberOrg.orgId)
const updatedMemberOrgId = await updateMemberOrg(
tx.transaction(),
memberId,
Expand Down Expand Up @@ -538,6 +544,19 @@

return updated
})

if (affectedOrgIds.length > 0) {
const commonMemberService = new CommonMemberService(
pgpQx(svc.postgres.writer.connection()),
svc.temporal,
svc.log,
)
await commonMemberService.startAffiliationRecalculation(memberId, [

Check failure on line 554 in services/apps/members_enrichment_worker/src/activities/enrichment.ts

View workflow job for this annotation

GitHub Actions / lint-format-services

Replace `⏎······...new·Set(affectedOrgIds),⏎····` with `...new·Set(affectedOrgIds)`
...new Set(affectedOrgIds),
])
Comment thread
ulemons marked this conversation as resolved.
Outdated
}

return updated
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
}

export function doesIncomingOrgExistInExistingOrgs(
Expand Down
Loading