INNER CODE UNIT · TypeScript

expiryDate

raj457036/CopyCat-Clipboard · supabase/functions/apply_promo_coupon/index.ts:52

  const expiryDate = new Date(now.setDate(now.getDate() + promo.duration));

  const updatedCustomer = await rc.grantEntitlement(
    userId,
    planEntitlementId,
    expiryDate.getTime(),
  );

  await serviceClient.from("promo_coupons").update({
    claimedAt: now.toISOString(),
    claimedBy: userId,
  }).eq("id", promo.id);

  return {
    status: 201,
    customer: toCustomerInfo(updatedCustomer),
  };
};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…