/** * Webhook Repository Port * * Defines the interface for Webhook persistence operations. * This is a secondary port (output port) in hexagonal architecture. */ import { Webhook, WebhookEvent } from '../../entities/webhook.entity'; export const WEBHOOK_REPOSITORY = 'WebhookRepository'; export interface WebhookFilters { organizationId?: string; status?: string[]; event?: WebhookEvent; } export interface WebhookRepository { /** * Save a webhook entity */ save(webhook: Webhook): Promise; /** * Find webhook by ID */ findById(id: string): Promise; /** * Find all webhooks for an organization */ findByOrganization(organizationId: string): Promise; /** * Find active webhooks by event and organization */ findActiveByEvent(event: WebhookEvent, organizationId: string): Promise; /** * Find webhooks by filters */ findByFilters(filters: WebhookFilters): Promise; /** * Delete a webhook */ delete(id: string): Promise; /** * Count webhooks for an organization */ countByOrganization(organizationId: string): Promise; }