Skip to content

Commit 82a6616

Browse files
feedback
1 parent a8dc2ae commit 82a6616

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

packages/backend/src/api.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { PromClient } from './promClient.js';
99
import { RepoIndexManager } from './repoIndexManager.js';
1010
import { createGitHubRepoRecord } from './repoCompileUtils.js';
1111
import { Octokit } from '@octokit/rest';
12+
import { SINGLE_TENANT_ORG_ID } from './constants.js';
1213

1314
const logger = createLogger('api');
1415
const PORT = 3060;
@@ -119,8 +120,16 @@ export class Api {
119120
isAutoCleanupDisabled: true,
120121
});
121122

122-
const repo = await this.prisma.repo.create({
123-
data: record,
123+
const repo = await this.prisma.repo.upsert({
124+
where: {
125+
external_id_external_codeHostUrl_orgId: {
126+
external_id: record.external_id,
127+
external_codeHostUrl: record.external_codeHostUrl,
128+
orgId: SINGLE_TENANT_ORG_ID,
129+
}
130+
},
131+
update: record,
132+
create: record,
124133
});
125134

126135
const [jobId ] = await this.repoIndexManager.createJobs([repo], RepoIndexingJobType.INDEX);

0 commit comments

Comments
 (0)