Skip to content

Add Webhook Delivery module #174

Description

@Benzilla

Add Webhook Delivery module

Parent: #172
Blocked by: #173

Goal

Add an internal API module that can create, persist and retrieve
WebhookDelivery records using the types introduced in #173

This establishes the persistence layer without changing existing webhook
dispatch behaviour.

Proposed solution

Create apps/api/src/modules/WebhookDelivery.ts containing a
WebhookDeliveryModule.

The module should initially support:

  • Creating and persisting a WebhookDelivery.
  • Retrieving a WebhookDelivery by ID.
  • Returning null when a delivery does not exist.

New deliveries should:

  • Use a generated ID with the whd_z prefix.
  • Reference one Event and one Webhook Endpoint.
  • Start with pending status.
  • Have delivered_at and claim_until set to null.
  • Have an empty attempts array.
  • Set next_attempt_at so the initial attempt is eligible for processing.

Add WebhookDeliveries to the collections initialized by
Database.EnsureCollections().

Follow the structure and dependency-injection patterns used by existing API
modules.

Expected files

  • apps/api/src/modules/WebhookDelivery.ts
  • apps/api/src/__tests__/WebhookDelivery.spec.ts
  • apps/api/src/modules/Database.ts

Acceptance criteria

  • WebhookDeliveryModule can create and persist a delivery.
  • Created deliveries use the whd_z ID prefix.
  • Created deliveries contain the expected initial values.
  • The module can retrieve a persisted delivery by ID.
  • Retrieving an unknown ID returns null.
  • The WebhookDeliveries collection is initialized with other known
    collections.
  • Focused tests cover creation, retrieval and missing deliveries.
  • npx nx test api passes.

Non-goals

  • Creating or recording delivery attempts
  • Delivery state transitions
  • Integration with EventService or WebhookDispatcher
  • Retry processing
  • Scheduler routes
  • Public API endpoints or request schemas

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions