From 5e49ea86661c070d620adc2c3e92c5a9d061f889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20L=C3=B3pez=20Guimaraes?= Date: Mon, 28 Aug 2023 17:58:32 +0100 Subject: [PATCH] Check for undefined on latest_webhook_timestamp Not all accounts are guaranteed to have this field, so we have to check if it exists. If it doesn't, just set the value to 0. --- src/services/grpc/api/get-user-data.ts | 4 ++-- src/services/grpc/api/update-user-data.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/grpc/api/get-user-data.ts b/src/services/grpc/api/get-user-data.ts index 33539a7..6682c79 100644 --- a/src/services/grpc/api/get-user-data.ts +++ b/src/services/grpc/api/get-user-data.ts @@ -38,9 +38,9 @@ export async function getUserData(_request: Empty, context: CallContext & Authen priceId: pnid.connections.stripe.price_id, tierLevel: pnid.connections.stripe.tier_level, tierName: pnid.connections.stripe.tier_name, - latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp) + latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp ?? 0) } }, marketingFlag: pnid.flags.marketing }; -} \ No newline at end of file +} diff --git a/src/services/grpc/api/update-user-data.ts b/src/services/grpc/api/update-user-data.ts index ae90135..bb82887 100644 --- a/src/services/grpc/api/update-user-data.ts +++ b/src/services/grpc/api/update-user-data.ts @@ -40,9 +40,9 @@ export async function updateUserData(_request: UpdateUserDataRequest, context: C priceId: pnid.connections.stripe.price_id, tierLevel: pnid.connections.stripe.tier_level, tierName: pnid.connections.stripe.tier_name, - latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp) + latestWebhookTimestamp: BigInt(pnid.connections.stripe.latest_webhook_timestamp ?? 0) } }, marketingFlag: pnid.flags.marketing }; -} \ No newline at end of file +}