Skip to content

Commit c24fdbd

Browse files
authored
Organization cache simplify enrichment (#276)
1 parent e282e2a commit c24fdbd

13 files changed

Lines changed: 102 additions & 176 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE public."organizationCaches" DROP COLUMN "enriched";
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ALTER TABLE public."organizationCaches" DROP COLUMN "location";
2+
ALTER TABLE public."organizationCaches" DROP COLUMN "github";
3+
ALTER TABLE public."organizationCaches" DROP COLUMN "website";
4+
5+
create unique index organizations_url_tenant_id
6+
on "organizations" (url,"tenantId");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE public."organizationCaches" ADD COLUMN "enriched" BOOLEAN NOT NULL DEFAULT FALSE;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ALTER TABLE public."organizationCaches" ADD "location" TEXT NULL;
2+
ALTER TABLE public."organizationCaches" ADD "github" JSONB NULL;
3+
ALTER TABLE public."organizationCaches" ADD "website" TEXT NULL;
4+
5+
drop index public.organizations_url_tenant_id;

backend/src/database/models/organizationCache.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ export default (sequelize) => {
5252
type: DataTypes.JSONB,
5353
default: {},
5454
},
55+
github: {
56+
type: DataTypes.JSONB,
57+
default: {},
58+
},
5559
crunchbase: {
5660
type: DataTypes.JSONB,
5761
default: {},
@@ -71,6 +75,14 @@ export default (sequelize) => {
7175
len: [0, 255],
7276
},
7377
},
78+
location: {
79+
type: DataTypes.TEXT,
80+
allowNull: true,
81+
},
82+
website: {
83+
type: DataTypes.TEXT,
84+
allowNull: true,
85+
},
7486
},
7587
{
7688
indexes: [

backend/src/database/repositories/__tests__/organizationCacheRepository.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ const toCreate = {
1313
logo: 'https://logo.clearbit.com/crowd.dev',
1414
tags: ['community', 'growth', 'developer-first'],
1515
parentUrl: null,
16+
website: 'https://crowd.dev',
17+
location: 'Berlin',
18+
github: {
19+
handle: 'CrowdDotDev',
20+
},
1621
twitter: {
1722
handle: 'CrowdDotDev',
1823
id: '1362101830923259908',

backend/src/database/repositories/organizationCacheRepository.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ class OrganizationCacheRepository {
2525
'employees',
2626
'revenueRange',
2727
'importHash',
28+
'enriched',
29+
'website',
30+
'github',
31+
'location',
2832
]),
2933
},
3034
{
@@ -68,6 +72,10 @@ class OrganizationCacheRepository {
6872
'employees',
6973
'revenueRange',
7074
'importHash',
75+
'enriched',
76+
'website',
77+
'github',
78+
'location',
7179
]),
7280
},
7381
{

backend/src/i18n/en.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ const en = {
109109
wrongEagleEyeSearch: {
110110
message: 'Wrong search parameters',
111111
},
112-
OrganizationNameOrUrlRequired: {
113-
message: 'Organization Name or Url is required',
112+
OrganizationNameRequired: {
113+
message: 'Organization Name is required',
114114
},
115115
projectNotFound: {
116116
message: 'Project not found',

backend/src/serverless/integrations/services/integrations/githubIntegrationService.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ export class GithubIntegrationService extends IntegrationServiceBase {
599599
? { handle: fromAPI.url.replace('https://github.com/', '') }
600600
: null,
601601
twitter: fromAPI.twitterUsername ? { handle: fromAPI.twitterUsername } : null,
602+
website: fromAPI.websiteUrl ?? null,
602603
},
603604
]
604605
} else {

backend/src/serverless/integrations/webhooks/github.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ export default class GitHubWebhook {
384384
? { handle: fromAPI.url.replace('https://github.com/', '') }
385385
: null,
386386
twitter: fromAPI.twitterUsername ? { handle: fromAPI.twitterUsername } : null,
387+
website: fromAPI.websiteUrl ?? null,
387388
},
388389
]
389390
} else {

0 commit comments

Comments
 (0)