Skip to content

Commit 23f2bd8

Browse files
authored
Display manually created organizations and members (#1383)
1 parent d5344c2 commit 23f2bd8

24 files changed

+106
-12
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE public."organizations" DROP COLUMN "manuallyCreated";
2+
ALTER TABLE public."members" DROP COLUMN "manuallyCreated";
3+
ALTER TABLE public."organizationCaches" DROP COLUMN "manuallyCreated";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE public."members" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;
2+
ALTER TABLE public."organizations" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;
3+
ALTER TABLE public."organizationCaches" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;

backend/src/database/models/member.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ export default (sequelize) => {
5757
enrichedBy: {
5858
type: DataTypes.ARRAY(DataTypes.TEXT),
5959
},
60+
manuallyCreated: {
61+
type: DataTypes.BOOLEAN,
62+
allowNull: false,
63+
defaultValue: false,
64+
},
6065
},
6166
{
6267
indexes: [

backend/src/database/models/organization.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ export default (sequelize) => {
150150
type: DataTypes.DATE,
151151
allowNull: true,
152152
},
153+
manuallyCreated: {
154+
type: DataTypes.BOOLEAN,
155+
allowNull: false,
156+
defaultValue: false,
157+
},
153158
attributes: {
154159
type: DataTypes.JSONB,
155160
defaultValue: {},

backend/src/database/models/organizationCache.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ export default (sequelize) => {
133133
type: DataTypes.DATE,
134134
allowNull: true,
135135
},
136+
manuallyCreated: {
137+
type: DataTypes.BOOLEAN,
138+
allowNull: false,
139+
defaultValue: false,
140+
},
136141
},
137142
{
138143
indexes: [

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ describe('MemberRepository tests', () => {
141141
numberOfOpenSourceContributions: 0,
142142
lastActivity: null,
143143
affiliations: [],
144+
manuallyCreated: false,
144145
}
145146
expect(memberCreated).toStrictEqual(expectedMemberCreated)
146147
})
@@ -210,6 +211,7 @@ describe('MemberRepository tests', () => {
210211
organizations: [],
211212
joinedAt: new Date('2020-05-27T15:13:30Z'),
212213
affiliations: [],
214+
manuallyCreated: false,
213215
}
214216
expect(memberCreated).toStrictEqual(expectedMemberCreated)
215217
})
@@ -272,6 +274,7 @@ describe('MemberRepository tests', () => {
272274
lastActive: null,
273275
lastActivity: null,
274276
affiliations: [],
277+
manuallyCreated: false,
275278
}
276279

277280
expect(memberCreated).toStrictEqual(expectedMemberCreated)
@@ -506,6 +509,7 @@ describe('MemberRepository tests', () => {
506509
lastActive: null,
507510
lastActivity: null,
508511
affiliations: [],
512+
manuallyCreated: false,
509513
}
510514

511515
const memberById = await MemberRepository.findById(memberCreated.id, mockIRepositoryOptions)
@@ -556,6 +560,7 @@ describe('MemberRepository tests', () => {
556560
organizations: [],
557561
joinedAt: new Date('2020-05-27T15:13:30Z'),
558562
affiliations: [],
563+
manuallyCreated: false,
559564
}
560565

561566
const memberById = await MemberRepository.findById(
@@ -726,6 +731,7 @@ describe('MemberRepository tests', () => {
726731
delete member1Returned.activeDaysCount
727732
delete member1Returned.numberOfOpenSourceContributions
728733
delete member1Returned.affiliations
734+
delete member1Returned.manuallyCreated
729735
member1Returned.segments = member1Returned.segments.map((s) => s.id)
730736

731737
const found = await MemberRepository.memberExists(
@@ -2985,6 +2991,7 @@ describe('MemberRepository tests', () => {
29852991
lastActive: null,
29862992
lastActivity: null,
29872993
affiliations: [],
2994+
manuallyCreated: false,
29882995
}
29892996

29902997
expect(updatedMember).toStrictEqual(expectedMemberCreated)
@@ -3083,6 +3090,7 @@ describe('MemberRepository tests', () => {
30833090
reach: { total: -1 },
30843091
joinedAt: new Date(updateFields.joinedAt),
30853092
affiliations: [],
3093+
manuallyCreated: false,
30863094
}
30873095

30883096
expect(updatedMember).toStrictEqual(expectedMemberCreated)
@@ -3167,6 +3175,7 @@ describe('MemberRepository tests', () => {
31673175
lastActive: null,
31683176
lastActivity: null,
31693177
affiliations: [],
3178+
manuallyCreated: false,
31703179
}
31713180

31723181
expect(member1).toStrictEqual(expectedMemberCreated)
@@ -3283,6 +3292,7 @@ describe('MemberRepository tests', () => {
32833292
lastActive: null,
32843293
lastActivity: null,
32853294
affiliations: [],
3295+
manuallyCreated: false,
32863296
}
32873297

32883298
expect(member1).toStrictEqual(expectedMemberCreated)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const toCreate = {
5050
founded: null,
5151
employeeCountByCountry: null,
5252
address: null,
53+
manuallyCreated: false,
5354
}
5455

5556
describe('OrganizationCacheCacheRepository tests', () => {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const toCreate = {
5252
employeeCountByCountry: null,
5353
address: null,
5454
profiles: null,
55+
manuallyCreated: false,
5556
}
5657

5758
async function createMembers(options) {

backend/src/database/repositories/memberRepository.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ class MemberRepository {
8585
'score',
8686
'reach',
8787
'joinedAt',
88+
'manuallyCreated',
8889
'importHash',
8990
]),
9091
tenantId: tenant.id,

backend/src/database/repositories/organizationCacheRepository.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class OrganizationCacheRepository {
4040
'address',
4141
'size',
4242
'lastEnrichedAt',
43+
'manuallyCreated',
4344
]),
4445
},
4546
{

0 commit comments

Comments
 (0)