fix(core): Declutter webhook insertion errors (#10650)

This commit is contained in:
Iván Ovejero
2024-09-03 17:58:26 +02:00
committed by GitHub
parent 2ea2bfe762
commit 36177b0943
2 changed files with 3 additions and 3 deletions

View File

@@ -179,12 +179,12 @@ describe('WebhookService', () => {
});
describe('createWebhook()', () => {
test('should create the webhook', async () => {
test('should store webhook in DB', async () => {
const mockWebhook = createWebhook('GET', 'user/:id');
await webhookService.storeWebhook(mockWebhook);
expect(webhookRepository.insert).toHaveBeenCalledWith(mockWebhook);
expect(webhookRepository.upsert).toHaveBeenCalledWith(mockWebhook, ['method', 'webhookPath']);
});
});
});

View File

@@ -93,7 +93,7 @@ export class WebhookService {
async storeWebhook(webhook: WebhookEntity) {
void this.cacheService.set(webhook.cacheKey, webhook);
return await this.webhookRepository.insert(webhook);
await this.webhookRepository.upsert(webhook, ['method', 'webhookPath']);
}
createWebhook(data: Partial<WebhookEntity>) {