Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
@@ -0,0 +1,3 @@
ALTER TABLE public."organizations" DROP COLUMN "manuallyCreated";
ALTER TABLE public."members" DROP COLUMN "manuallyCreated";
ALTER TABLE public."organizationCaches" DROP COLUMN "manuallyCreated";
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE public."members" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;
ALTER TABLE public."organizations" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;
ALTER TABLE public."organizationCaches" ADD COLUMN "manuallyCreated" boolean NOT NULL DEFAULT false;
5 changes: 5 additions & 0 deletions backend/src/database/models/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ export default (sequelize) => {
enrichedBy: {
type: DataTypes.ARRAY(DataTypes.TEXT),
},
manuallyCreated: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
},
{
indexes: [
Expand Down
5 changes: 5 additions & 0 deletions backend/src/database/models/organization.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ export default (sequelize) => {
type: DataTypes.DATE,
allowNull: true,
},
manuallyCreated: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
attributes: {
type: DataTypes.JSONB,
defaultValue: {},
Expand Down
5 changes: 5 additions & 0 deletions backend/src/database/models/organizationCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ export default (sequelize) => {
type: DataTypes.DATE,
allowNull: true,
},
manuallyCreated: {
type: DataTypes.BOOLEAN,
allowNull: false,
defaultValue: false,
},
},
{
indexes: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ describe('MemberRepository tests', () => {
numberOfOpenSourceContributions: 0,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}
expect(memberCreated).toStrictEqual(expectedMemberCreated)
})
Expand Down Expand Up @@ -210,6 +211,7 @@ describe('MemberRepository tests', () => {
organizations: [],
joinedAt: new Date('2020-05-27T15:13:30Z'),
affiliations: [],
manuallyCreated: false,
}
expect(memberCreated).toStrictEqual(expectedMemberCreated)
})
Expand Down Expand Up @@ -272,6 +274,7 @@ describe('MemberRepository tests', () => {
lastActive: null,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(expectedMemberCreated)
Expand Down Expand Up @@ -506,6 +509,7 @@ describe('MemberRepository tests', () => {
lastActive: null,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}

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

const memberById = await MemberRepository.findById(
Expand Down Expand Up @@ -726,6 +731,7 @@ describe('MemberRepository tests', () => {
delete member1Returned.activeDaysCount
delete member1Returned.numberOfOpenSourceContributions
delete member1Returned.affiliations
delete member1Returned.manuallyCreated
member1Returned.segments = member1Returned.segments.map((s) => s.id)

const found = await MemberRepository.memberExists(
Expand Down Expand Up @@ -2985,6 +2991,7 @@ describe('MemberRepository tests', () => {
lastActive: null,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}

expect(updatedMember).toStrictEqual(expectedMemberCreated)
Expand Down Expand Up @@ -3083,6 +3090,7 @@ describe('MemberRepository tests', () => {
reach: { total: -1 },
joinedAt: new Date(updateFields.joinedAt),
affiliations: [],
manuallyCreated: false,
}

expect(updatedMember).toStrictEqual(expectedMemberCreated)
Expand Down Expand Up @@ -3167,6 +3175,7 @@ describe('MemberRepository tests', () => {
lastActive: null,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}

expect(member1).toStrictEqual(expectedMemberCreated)
Expand Down Expand Up @@ -3283,6 +3292,7 @@ describe('MemberRepository tests', () => {
lastActive: null,
lastActivity: null,
affiliations: [],
manuallyCreated: false,
}

expect(member1).toStrictEqual(expectedMemberCreated)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const toCreate = {
founded: null,
employeeCountByCountry: null,
address: null,
manuallyCreated: false,
}

describe('OrganizationCacheCacheRepository tests', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const toCreate = {
employeeCountByCountry: null,
address: null,
profiles: null,
manuallyCreated: false,
}

async function createMembers(options) {
Expand Down
1 change: 1 addition & 0 deletions backend/src/database/repositories/memberRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ class MemberRepository {
'score',
'reach',
'joinedAt',
'manuallyCreated',
'importHash',
]),
tenantId: tenant.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class OrganizationCacheRepository {
'address',
'size',
'lastEnrichedAt',
'manuallyCreated',
]),
},
{
Expand Down
20 changes: 17 additions & 3 deletions backend/src/database/repositories/organizationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ class OrganizationRepository {
'founded',
'size',
'lastEnrichedAt',
'manuallyCreated',
]),

tenantId: tenant.id,
Expand Down Expand Up @@ -630,9 +631,18 @@ class OrganizationRepository {

if (filter.and) {
filter.and.push({
activityCount: {
gt: 0,
},
or: [
{
manuallyCreated: {
eq: true,
},
},
{
activityCount: {
gt: 0,
},
},
],
})
}

Expand Down Expand Up @@ -685,6 +695,8 @@ class OrganizationRepository {
}
}

console.log('parsed organization query', JSON.stringify(parsed))

const response = await options.opensearch.search({
index: OpenSearchIndex.ORGANIZATIONS,
body: parsed,
Expand Down Expand Up @@ -995,6 +1007,7 @@ class OrganizationRepository {
'isTeamOrganization',
'type',
'attributes',
'manuallyCreated',
],
'organization',
),
Expand Down Expand Up @@ -1093,6 +1106,7 @@ class OrganizationRepository {
'address',
'profiles',
'attributes',
'manuallyCreated',
],
'organization',
),
Expand Down
20 changes: 20 additions & 0 deletions backend/src/services/__tests__/memberService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ describe('MemberService tests', () => {
enrichedBy: [],
contributions: null,
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -276,6 +277,7 @@ describe('MemberService tests', () => {
reach: { total: -1 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -328,6 +330,7 @@ describe('MemberService tests', () => {
reach: { total: 10, [PlatformType.GITHUB]: 10 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -379,6 +382,7 @@ describe('MemberService tests', () => {
reach: { total: 20, [PlatformType.GITHUB]: 10, [PlatformType.TWITTER]: 10 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -430,6 +434,7 @@ describe('MemberService tests', () => {
reach: { total: 20, [PlatformType.DISCORD]: 10, [PlatformType.TWITTER]: 10 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
affiliations: [],
manuallyCreated: false,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -508,6 +513,7 @@ describe('MemberService tests', () => {
address: null,
profiles: null,
attributes: {},
manuallyCreated: false,
})
})

Expand Down Expand Up @@ -584,6 +590,7 @@ describe('MemberService tests', () => {
address: null,
profiles: null,
attributes: {},
manuallyCreated: false,
})
})

Expand Down Expand Up @@ -664,6 +671,7 @@ describe('MemberService tests', () => {
address: null,
profiles: null,
attributes: {},
manuallyCreated: false,
})
})

Expand Down Expand Up @@ -760,6 +768,7 @@ describe('MemberService tests', () => {
address: null,
profiles: null,
attributes: {},
manuallyCreated: false,
})
})

Expand Down Expand Up @@ -860,6 +869,7 @@ describe('MemberService tests', () => {
joinedAt: new Date('2020-05-28T15:13:30Z'),
reach: { total: -1 },
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -971,6 +981,7 @@ describe('MemberService tests', () => {
joinedAt: new Date('2020-05-28T15:13:30Z'),
reach: { total: -1 },
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1077,6 +1088,7 @@ describe('MemberService tests', () => {
joinedAt: new Date('2020-05-28T15:13:30Z'),
reach: { total: -1 },
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1255,6 +1267,7 @@ describe('MemberService tests', () => {
updatedById: mockIServiceOptions.currentUser.id,
reach: { total: -1 },
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1311,6 +1324,7 @@ describe('MemberService tests', () => {
emails: [],
attributes: {},
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1368,6 +1382,7 @@ describe('MemberService tests', () => {
emails: [],
attributes: {},
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1426,6 +1441,7 @@ describe('MemberService tests', () => {
emails: [],
attributes: {},
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1484,6 +1500,7 @@ describe('MemberService tests', () => {
emails: [],
attributes: {},
affiliations: [],
manuallyCreated: false,
}

expect(memberUpdated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -1888,6 +1905,7 @@ describe('MemberService tests', () => {
lastActivity: activityCreated,
numberOfOpenSourceContributions: 0,
affiliations: [],
manuallyCreated: false,
}

expect(
Expand Down Expand Up @@ -2128,6 +2146,7 @@ describe('MemberService tests', () => {
delete returnedMember1.activeDaysCount
delete returnedMember1.numberOfOpenSourceContributions
delete returnedMember1.affiliations
delete returnedMember1.manuallyCreated

returnedMember1.segments = returnedMember1.segments.map((s) => s.id)

Expand Down Expand Up @@ -2228,6 +2247,7 @@ describe('MemberService tests', () => {
delete returnedMember1.activeDaysCount
delete returnedMember1.numberOfOpenSourceContributions
delete returnedMember1.affiliations
delete returnedMember1.manuallyCreated

returnedMember1.segments = returnedMember1.segments.map((s) => s.id)

Expand Down
4 changes: 3 additions & 1 deletion frontend/src/modules/member/pages/member-form-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ import {
import { onBeforeRouteLeave, useRoute, useRouter } from 'vue-router';
import isEqual from 'lodash/isEqual';
import { useStore } from 'vuex';
import { storeToRefs } from 'pinia';
import AppMemberFormDetails from '@/modules/member/components/form/member-form-details.vue';
import AppMemberFormIdentities from '@/modules/member/components/form/member-form-identities.vue';
import AppMemberFormAttributes from '@/modules/member/components/form/member-form-attributes.vue';
Expand All @@ -129,7 +130,6 @@ import getCustomAttributes from '@/shared/fields/get-custom-attributes';
import getAttributesModel from '@/shared/attributes/get-attributes-model';
import getParsedAttributes from '@/shared/attributes/get-parsed-attributes';
import { useMemberStore } from '@/modules/member/store/pinia';
import { storeToRefs } from 'pinia';

const LoaderIcon = h(
'i',
Expand Down Expand Up @@ -383,6 +383,8 @@ async function onSubmit() {
...Object.keys(formModel.value.username).length && {
username: formModel.value.username,
},

manuallyCreated: true,
};

let isRequestSuccessful = false;
Expand Down
Loading