add select primary calendar (#1133)

* add primary

* fix

* refactor eventmanager to take `CalendarDestination`

* `DestinationCalendar`

* fix

* wip

* wip

* Minor fixes (#1156)

* Followup for #1242

* Updates schema

* Renames fields to destinationCalendar

* Migration fixes

* Updates user destination calendar

* Abstracts convertDate to BaseCalendarApiAdapter

* Type fixes

* Uses abstracted convertDate method

* Abstracts getDuration and getAttendees

* Fixes circular dependecy issue

* Adds notEmpty util

* Reverts empty location string

* Fixes property name

* Removes deprecated code

* WIP

* AppleCal is basically CalDav

* Fixes missing destinationCalendar

* Type fixes

* Select primary calendar on Office and gCal

* Adds pretty basic instructions for destination calendar

* Cleanup

* Type fix

* Test fixes

* Updates test snapshot

* Local test fixes

* Type fixes

Co-authored-by: Peer Richelsen <[email protected]>
Co-authored-by: Omar López <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2021-12-09 15:51:37 +00:00
1 parent 1890d5daf7
commit 850497ea80
26 files changed
+745 -917

No files matched your search

+5 -6
View File
@@ -1,6 +1,5 @@
import { PaymentType } from "@prisma/client";
import { PaymentType, Prisma } from "@prisma/client";
import Stripe from "stripe";
import { JsonValue } from "type-fest";
import { v4 as uuidv4 } from "uuid";
import { CalendarEvent } from "@lib/calendarClient";
@@ -39,7 +38,7 @@ export async function handlePayment(
price: number;
currency: string;
},
stripeCredential: { key: JsonValue },
stripeCredential: { key: Prisma.JsonValue },
booking: {
user: { email: string | null; name: string | null; timeZone: string } | null;
id: number;
@@ -74,7 +73,7 @@ export async function handlePayment(
data: Object.assign({}, paymentIntent, {
stripe_publishable_key,
stripeAccount: stripe_user_id,
}) as PaymentData as unknown as JsonValue,
}) as PaymentData as unknown as Prisma.JsonValue,
externalId: paymentIntent.id,
},
});
@@ -103,7 +102,7 @@ export async function refund(
success: boolean;
refunded: boolean;
externalId: string;
data: JsonValue;
data: Prisma.JsonValue;
type: PaymentType;
}[];
},
@@ -113,7 +112,7 @@ export async function refund(
const payment = booking.payment.find((e) => e.success && !e.refunded);
if (!payment) return;
if (payment.type != PaymentType.STRIPE) {
if (payment.type !== PaymentType.STRIPE) {
await handleRefundError({
event: calEvent,
reason: "cannot refund non Stripe payment",