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,2 @@
ALTER TABLE public."members" ADD COLUMN "isEnriched" BOOLEAN DEFAULT false;
ALTER TABLE public."members" DROP COLUMN "lastEnriched";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE public."members" DROP COLUMN "isEnriched";
ALTER TABLE public."members" ADD COLUMN "lastEnriched" TIMESTAMP DEFAULT NULL;
5 changes: 2 additions & 3 deletions backend/src/database/models/member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ export default (sequelize) => {
total: -1,
},
},
isEnriched: {
type: DataTypes.BOOLEAN,
defaultValue: false,
lastEnriched: {
type: DataTypes.DATE,
},
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe('MemberRepository tests', () => {
email: member2add.email,
score: member2add.score,
identities: ['github'],
isEnriched: false,
lastEnriched: null,
organizations: [],
notes: [],
tasks: [],
Expand Down Expand Up @@ -141,7 +141,7 @@ describe('MemberRepository tests', () => {
displayName: member2add.displayName,
attributes: member2add.attributes,
email: member2add.email,
isEnriched: false,
lastEnriched: null,
score: member2add.score,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -179,7 +179,7 @@ describe('MemberRepository tests', () => {
attributes: {},
identities: ['github'],
email: null,
isEnriched: false,
lastEnriched: null,
score: -1,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -318,7 +318,7 @@ describe('MemberRepository tests', () => {
identities: ['github'],
attributes: {},
email: null,
isEnriched: false,
lastEnriched: null,
score: -1,
importHash: null,
organizations: [],
Expand Down Expand Up @@ -369,7 +369,7 @@ describe('MemberRepository tests', () => {
id: memberCreated.id,
username: member2add.username,
displayName: member2add.displayName,
isEnriched: false,
lastEnriched: null,
attributes: {},
email: null,
score: -1,
Expand Down Expand Up @@ -1303,7 +1303,7 @@ describe('MemberRepository tests', () => {
attributes: updateFields.attributes,
email: updateFields.email,
score: updateFields.score,
isEnriched: false,
lastEnriched: null,
organizations: [],
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1391,7 +1391,7 @@ describe('MemberRepository tests', () => {
username: updateFields.username,
displayName: returnedMember.displayName,
attributes: updateFields.attributes,
isEnriched: false,
lastEnriched: null,
email: updateFields.email,
score: updateFields.score,
importHash: null,
Expand Down Expand Up @@ -1454,7 +1454,7 @@ describe('MemberRepository tests', () => {
email: member1.email,
score: member1.score,
organizations: [],
isEnriched: false,
lastEnriched: null,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
updatedAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1536,7 +1536,7 @@ describe('MemberRepository tests', () => {
email: member1.email,
score: member1.score,
tags: [],
isEnriched: false,
lastEnriched: null,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
updatedAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down
10 changes: 5 additions & 5 deletions backend/src/database/repositories/memberRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MemberRepository {
'displayName',
'attributes',
'email',
'isEnriched',
'lastEnriched',
'score',
'reach',
'joinedAt',
Expand Down Expand Up @@ -211,7 +211,7 @@ class MemberRepository {
const currentTenant = SequelizeRepository.getCurrentTenant(options)

const query =
'SELECT "id", "username", "displayName", "attributes", "email", "score", "isEnriched", "reach", "joinedAt", "importHash", "createdAt", "updatedAt", "deletedAt", "tenantId", "createdById", "updatedById" FROM "members" AS "member" WHERE ("member"."deletedAt" IS NULL AND ("member"."tenantId" = $tenantId AND ("member"."username"->>$platform) = $username)) LIMIT 1;'
'SELECT "id", "username", "displayName", "attributes", "email", "score", "lastEnriched", "reach", "joinedAt", "importHash", "createdAt", "updatedAt", "deletedAt", "tenantId", "createdById", "updatedById" FROM "members" AS "member" WHERE ("member"."deletedAt" IS NULL AND ("member"."tenantId" = $tenantId AND ("member"."username"->>$platform) = $username)) LIMIT 1;'

const records = await options.database.sequelize.query(query, {
type: Sequelize.QueryTypes.SELECT,
Expand Down Expand Up @@ -259,7 +259,7 @@ class MemberRepository {
'displayName',
'attributes',
'email',
'isEnriched',
'lastEnriched',
'score',
'reach',
'joinedAt',
Expand Down Expand Up @@ -797,7 +797,7 @@ class MemberRepository {
'displayName',
'email',
'score',
'isEnriched',
'lastEnriched',
'joinedAt',
'importHash',
'reach',
Expand Down Expand Up @@ -874,7 +874,7 @@ class MemberRepository {
'email',
'tenantId',
'score',
'isEnriched',
'lastEnriched',
'joinedAt',
'importHash',
'createdAt',
Expand Down
30 changes: 15 additions & 15 deletions backend/src/services/__tests__/memberService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ describe('MemberService tests', () => {
updatedById: mockIServiceOptions.currentUser.id,
reach: { total: -1 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
isEnriched: false,
lastEnriched: null,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -256,7 +256,7 @@ describe('MemberService tests', () => {
updatedById: mockIServiceOptions.currentUser.id,
reach: { total: -1 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
isEnriched: false,
lastEnriched: null,
}

expect(memberCreated).toStrictEqual(memberExpected)
Expand Down Expand Up @@ -339,7 +339,7 @@ describe('MemberService tests', () => {
tenantId: mockIServiceOptions.currentTenant.id,
createdById: mockIServiceOptions.currentUser.id,
updatedById: mockIServiceOptions.currentUser.id,
isEnriched: false,
lastEnriched: null,
reach: { total: -1 },
joinedAt: new Date('2020-05-28T15:13:30Z'),
}
Expand Down Expand Up @@ -378,7 +378,7 @@ describe('MemberService tests', () => {
displayName: username,
attributes: {},
email: member1.email,
isEnriched: false,
lastEnriched: null,
score: member1.score,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -423,7 +423,7 @@ describe('MemberService tests', () => {
},
displayName: username,
attributes: {},
isEnriched: false,
lastEnriched: null,
email: member1.email,
score: member1.score,
importHash: null,
Expand Down Expand Up @@ -471,7 +471,7 @@ describe('MemberService tests', () => {
attributes: {},
email: member1.email,
score: member1.score,
isEnriched: false,
lastEnriched: null,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
updatedAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -886,7 +886,7 @@ describe('MemberService tests', () => {
default: attributes[MemberAttributeName.LOCATION][PlatformType.GITHUB],
},
},
isEnriched: false,
lastEnriched: null,
email: member1.email,
score: member1.score,
importHash: null,
Expand Down Expand Up @@ -992,7 +992,7 @@ describe('MemberService tests', () => {
default: attributes2[MemberAttributeName.LOCATION][PlatformType.GITHUB],
},
},
isEnriched: false,
lastEnriched: null,
email: member1.email,
score: member1.score,
importHash: null,
Expand Down Expand Up @@ -1090,7 +1090,7 @@ describe('MemberService tests', () => {
},
},
email: member1.email,
isEnriched: false,
lastEnriched: null,
score: member1.score,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1264,7 +1264,7 @@ describe('MemberService tests', () => {
},
},
email: member1.email,
isEnriched: false,
lastEnriched: null,
score: member1.score,
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1313,7 +1313,7 @@ describe('MemberService tests', () => {
[PlatformType.GITHUB]: member1Username,
},
displayName: member1Username,
isEnriched: false,
lastEnriched: null,
reach: { total: 10, [PlatformType.GITHUB]: 10 },
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1364,7 +1364,7 @@ describe('MemberService tests', () => {
username: {
[PlatformType.GITHUB]: member1Username,
},
isEnriched: false,
lastEnriched: null,
displayName: member1Username,
reach: { total: 10, [PlatformType.GITHUB]: 10 },
importHash: null,
Expand Down Expand Up @@ -1417,7 +1417,7 @@ describe('MemberService tests', () => {
username: {
[PlatformType.GITHUB]: member1Username,
},
isEnriched: false,
lastEnriched: null,
displayName: member1Username,
reach: { total: 36, [PlatformType.GITHUB]: 15, linkedin: 11, [PlatformType.TWITTER]: 10 },
importHash: null,
Expand Down Expand Up @@ -1471,7 +1471,7 @@ describe('MemberService tests', () => {
[PlatformType.GITHUB]: member1Username,
},
displayName: member1Username,
isEnriched: false,
lastEnriched: null,
reach: { total: 50, [PlatformType.GITHUB]: 30, linkedin: 10, [PlatformType.TWITTER]: 10 },
importHash: null,
createdAt: SequelizeTestUtils.getNowWithoutTime(),
Expand Down Expand Up @@ -1714,7 +1714,7 @@ describe('MemberService tests', () => {
[PlatformType.GITHUB]: member1.username.github,
[PlatformType.DISCORD]: member2.username.discord,
},
isEnriched: false,
lastEnriched: null,
displayName: member1.displayName,
identities: [PlatformType.GITHUB, PlatformType.DISCORD],
activities: [activityCreated],
Expand Down