Skip to content

Commit

Permalink
Fix contributor script
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixMalfait committed Sep 16, 2024
1 parent 872f529 commit 463d57e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,14 @@ export async function saveIssuesToDB(
isEmployee: assignableUsers.has(issue.author.login) ? '1' : '0',
},
],
{ onConflictKey: 'id' },
{
onConflictKey: 'id',
onConflictUpdateObject: {
avatarUrl: issue.author.avatarUrl,
url: issue.author.url,
isEmployee: assignableUsers.has(issue.author.login) ? '1' : '0',
},
},
);

await insertMany(
Expand All @@ -44,7 +51,14 @@ export async function saveIssuesToDB(
],
{
onConflictKey: 'id',
onConflictUpdateObject: { updatedAt: issue.updatedAt },
onConflictUpdateObject: {
title: issue.title,
body: issue.body,
url: issue.url,
updatedAt: issue.updatedAt,
closedAt: issue.closedAt,
authorId: issue.author.login,
},
},
);

Expand All @@ -59,7 +73,14 @@ export async function saveIssuesToDB(
description: label.description,
},
],
{ onConflictKey: 'id' },
{
onConflictKey: 'id',
onConflictUpdateObject: {
name: label.name,
color: label.color,
description: label.description,
},
},
);
await insertMany(issueLabelModel, [
{
Expand Down
28 changes: 25 additions & 3 deletions packages/twenty-website/src/github/contributors/save-prs-to-db.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ export async function savePRsToDB(
isEmployee: assignableUsers.has(pr.author.login) ? '1' : '0',
},
],
{ onConflictKey: 'id' },
{
onConflictKey: 'id',
onConflictUpdateObject: {
avatarUrl: pr.author.avatarUrl,
url: pr.author.url,
isEmployee: assignableUsers.has(pr.author.login) ? '1' : '0',
},
},
);

await insertMany(
Expand All @@ -46,7 +53,15 @@ export async function savePRsToDB(
],
{
onConflictKey: 'id',
onConflictUpdateObject: { title: pr.title, updatedAt: pr.updatedAt },
onConflictUpdateObject: {
title: pr.title,
body: pr.body,
url: pr.url,
updatedAt: pr.updatedAt,
closedAt: pr.closedAt,
mergedAt: pr.mergedAt,
authorId: pr.author.login,
},
},
);

Expand All @@ -61,7 +76,14 @@ export async function savePRsToDB(
description: label.description,
},
],
{ onConflictKey: 'id' },
{
onConflictKey: 'id',
onConflictUpdateObject: {
name: label.name,
color: label.color,
description: label.description,
},
},
);
await insertMany(pullRequestLabelModel, [
{
Expand Down

0 comments on commit 463d57e

Please sign in to comment.