feat: use cal video as the default location (#6643)

* feat: use cal video as default while creating new events

* feat: use cal video as default value

* chore: remove default value

* fix: default value logic

* chore: remove console.log
This commit is contained in:
Nafees Nazik authored and GitHub committed 2023-01-24 15:28:40 +00:00
1 parent 905a110377
commit 796a5f8d51
2 files changed
+5 -7

No files matched your search

@@ -404,7 +404,7 @@ export const eventTypesRouter = router({
create: authedProcedure.input(createEventTypeInput).mutation(async ({ ctx, input }) => {
const { schedulingType, teamId, ...rest } = input;
const userId = ctx.user.id;
const appKeys = await getAppKeysFromSlug("daily-video");
const data: Prisma.EventTypeCreateInput = {
...rest,
owner: teamId ? undefined : { connect: { id: userId } },
@@ -413,14 +413,10 @@ export const eventTypesRouter = router({
id: userId,
},
},
...((typeof rest?.locations === "undefined" || rest.locations?.length === 0) &&
typeof appKeys.api_key === "string" && { locations: [{ type: DailyLocationType }] }),
};
const appKeys = await getAppKeysFromSlug("daily-video");
// Shouldn't override input locations
if (rest.locations?.length === 0 && typeof appKeys.api_key === "string") {
data.locations = [{ type: DailyLocationType }];
}
if (teamId && schedulingType) {
const hasMembership = await ctx.prisma.membership.findFirst({
where: {