Add tenantDomain to StoryCreatedEventPayload (#2899)

* Add tenantID and siteID to StoryCreatedEventPayload

* fix: added tenantID to payload

* Remove tenantID from StoryCreatedCoralEvent

* Add tenantDomain to webhook schema

* fix: small comment fixes

Co-authored-by: Wyatt Johnson <me@wyattjoh.ca>
This commit is contained in:
Cristian Dean
2020-04-02 18:39:58 -03:00
committed by GitHub
parent 94ece10284
commit 7c3c510bbc
4 changed files with 36 additions and 2 deletions
@@ -82,9 +82,21 @@ export function generateSignatures(
.join(",");
}
type CoralWebhookEventPayload = CoralEventPayload & {
/**
* tenantID is the ID of the Tenant that this event originated at.
*/
readonly tenantID: string;
/**
* tenantDomain is the domain that is associated with this Tenant that this event originated at.
*/
readonly tenantDomain: string;
};
export function generateFetchOptions(
endpoint: Pick<Endpoint, "signingSecrets">,
data: CoralEventPayload,
data: CoralWebhookEventPayload,
now: Date
): FetchOptions {
// Serialize the body and signature to include in the request.
@@ -151,7 +163,11 @@ export function createJobProcessor({
const now = new Date();
// Get the fetch options.
const options = generateFetchOptions(endpoint, event, now);
const options = generateFetchOptions(
endpoint,
{ ...event, tenantID, tenantDomain: tenant.domain },
now
);
// Send the request.
const startedSendingAt = getNow();